14 #define STDCALL __stdcall
20 extern __declspec(dllimport
) __stdcall
void CoTaskMemFree(void *ptr
);
23 typedef int (STDCALL
*SimpleDelegate
) (int a
);
25 static void marshal_free (void *ptr
)
34 STDCALL
unsigned short*
35 test_lpwstr_marshal (unsigned short* chars
, long length
)
40 res
= malloc (2 * (length
+ 1));
42 // printf("test_lpwstr_marshal()\n");
44 while ( i
< length
) {
45 // printf("X|%u|\n", chars[i]);
62 mono_union_test_1 (union_test_1_type u1
) {
63 // printf ("Got values %d %d %d\n", u1.b, u1.a, u1.c);
64 return u1
.a
+ u1
.b
+ u1
.c
;
68 mono_return_int (int a
) {
69 // printf ("Got value %d\n", a);
79 mono_return_int_ss (struct ss a
) {
80 // printf ("Got value %d\n", a.i);
85 mono_return_ss (struct ss a
) {
86 // printf ("Got value %d\n", a.i);
97 mono_return_sc1 (struct sc1 a
) {
98 // printf ("Got value %d\n", a.c[0]);
110 mono_return_sc3 (struct sc3 a
) {
111 // printf ("Got values %d %d %d\n", a.c[0], a.c[1], a.c[2]);
124 mono_return_sc5 (struct sc5 a
) {
125 // printf ("Got values %d %d %d %d %d\n", a.c[0], a.c[1], a.c[2], a.c[3], a.c[4]);
141 mono_return_int_su (union su a
) {
142 // printf ("Got value %d\n", a.i1);
147 mono_test_many_int_arguments (int a
, int b
, int c
, int d
, int e
,
148 int f
, int g
, int h
, int i
, int j
);
150 mono_test_many_short_arguments (short a
, short b
, short c
, short d
, short e
,
151 short f
, short g
, short h
, short i
, short j
);
153 mono_test_many_char_arguments (char a
, char b
, char c
, char d
, char e
,
154 char f
, char g
, char h
, char i
, char j
);
157 mono_test_many_int_arguments (int a
, int b
, int c
, int d
, int e
, int f
, int g
, int h
, int i
, int j
)
159 return a
+ b
+ c
+ d
+ e
+ f
+ g
+ h
+ i
+ j
;
163 mono_test_many_short_arguments (short a
, short b
, short c
, short d
, short e
, short f
, short g
, short h
, short i
, short j
)
165 return a
+ b
+ c
+ d
+ e
+ f
+ g
+ h
+ i
+ j
;
169 mono_test_many_byte_arguments (char a
, char b
, char c
, char d
, char e
, char f
, char g
, char h
, char i
, char j
)
171 return a
+ b
+ c
+ d
+ e
+ f
+ g
+ h
+ i
+ j
;
175 mono_test_many_float_arguments (float a
, float b
, float c
, float d
, float e
, float f
, float g
, float h
, float i
, float j
)
177 return a
+ b
+ c
+ d
+ e
+ f
+ g
+ h
+ i
+ j
;
181 mono_test_many_double_arguments (double a
, double b
, double c
, double d
, double e
, double f
, double g
, double h
, double i
, double j
)
183 return a
+ b
+ c
+ d
+ e
+ f
+ g
+ h
+ i
+ j
;
187 mono_test_split_double_arguments (double a
, double b
, float c
, double d
, double e
)
189 return a
+ b
+ c
+ d
+ e
;
193 mono_test_puts_static (char *s
)
195 // printf ("TEST %s\n", s);
199 typedef int (STDCALL
*SimpleDelegate3
) (int a
, int b
);
202 mono_invoke_delegate (SimpleDelegate3 delegate
)
206 // printf ("start invoke %p\n", delegate);
208 res
= delegate (2, 3);
210 // printf ("end invoke\n");
216 mono_test_marshal_char (short a1
)
225 mono_test_marshal_char_array (gunichar2
*s
)
227 const char m
[] = "abcdef";
231 s2
= g_utf8_to_utf16 (m
, -1, NULL
, &len
, NULL
);
240 mono_test_empty_pinvoke (int i
)
246 mono_test_marshal_bool_byref (int a
, int *b
, int c
)
256 mono_test_marshal_array (int *a1
)
260 for (i
= 0; i
< 50; i
++)
267 mono_test_marshal_inout_array (int *a1
)
271 for (i
= 0; i
< 50; i
++) {
273 a1
[i
] = 50 - a1
[i
];
280 mono_test_marshal_out_array (int *a1
)
284 for (i
= 0; i
< 50; i
++) {
292 mono_test_marshal_inout_nonblittable_array (gunichar2
*a1
)
296 for (i
= 0; i
< 10; i
++) {
317 mono_test_return_vtype (int i
)
320 static gunichar2 test2
[] = { 'T', 'E', 'S', 'T', '2', 0 };
332 mono_test_delegate_struct (void)
334 // printf ("TEST\n");
337 typedef char* (STDCALL
*ReturnStringDelegate
) (const char *s
);
340 mono_test_return_string (ReturnStringDelegate func
)
344 // printf ("mono_test_return_string\n");
349 // printf ("got string: %s\n", res);
350 return g_strdup ("12345");
353 typedef int (STDCALL
*RefVTypeDelegate
) (int a
, simplestruct
*ss
, int b
);
356 mono_test_ref_vtype (int a
, simplestruct
*ss
, int b
, RefVTypeDelegate func
)
358 if (a
== 1 && b
== 2 && ss
->a
== 0 && ss
->b
== 1 && ss
->c
== 0 &&
359 !strcmp (ss
->d
, "TEST1")) {
365 return func (a
, ss
, b
);
371 typedef int (STDCALL
*OutVTypeDelegate
) (int a
, simplestruct
*ss
, int b
);
374 mono_test_marshal_out_struct (int a
, simplestruct
*ss
, int b
, OutVTypeDelegate func
)
376 /* Check that the input pointer is ignored */
377 ss
->d
= (gpointer
)0x12345678;
381 if (ss
->a
&& ss
->b
&& ss
->c
&& !strcmp (ss
->d
, "TEST3"))
389 SimpleDelegate func
, func2
;
392 STDCALL DelegateStruct
393 mono_test_marshal_delegate_struct (DelegateStruct ds
)
397 res
.a
= ds
.func (ds
.a
) + ds
.func2 (ds
.a
);
399 res
.func2
= ds
.func2
;
405 mono_test_marshal_struct (simplestruct ss
)
407 if (ss
.a
== 0 && ss
.b
== 1 && ss
.c
== 0 &&
408 !strcmp (ss
.d
, "TEST"))
415 mono_test_marshal_byref_struct (simplestruct
*ss
, int a
, int b
, int c
, char *d
)
417 gboolean res
= (ss
->a
== a
&& ss
->b
== b
&& ss
->c
== c
&& strcmp (ss
->d
, d
) == 0);
422 ss
->d
= g_strdup ("DEF");
439 mono_test_marshal_struct2 (simplestruct2 ss
)
441 if (ss
.a
== 0 && ss
.b
== 1 && ss
.c
== 0 &&
442 !strcmp (ss
.d
, "TEST") &&
443 ss
.e
== 99 && ss
.f
== 1.5 && ss
.g
== 42 && ss
.h
== (guint64
)123)
449 /* on HP some of the struct should be on the stack and not in registers */
451 mono_test_marshal_struct2_2 (int i
, int j
, int k
, simplestruct2 ss
)
453 if (i
!= 10 || j
!= 11 || k
!= 12)
455 if (ss
.a
== 0 && ss
.b
== 1 && ss
.c
== 0 &&
456 !strcmp (ss
.d
, "TEST") &&
457 ss
.e
== 99 && ss
.f
== 1.5 && ss
.g
== 42 && ss
.h
== (guint64
)123)
464 mono_test_marshal_lpstruct (simplestruct
*ss
)
466 if (ss
->a
== 0 && ss
->b
== 1 && ss
->c
== 0 &&
467 !strcmp (ss
->d
, "TEST"))
474 mono_test_marshal_lpstruct_blittable (point
*p
)
476 if (p
->x
== 1.0 && p
->y
== 2.0)
483 mono_test_marshal_struct_array (simplestruct2
*ss
)
485 if (! (ss
[0].a
== 0 && ss
[0].b
== 1 && ss
[0].c
== 0 &&
486 !strcmp (ss
[0].d
, "TEST") &&
487 ss
[0].e
== 99 && ss
[0].f
== 1.5 && ss
[0].g
== 42 && ss
[0].h
== (guint64
)123))
490 if (! (ss
[1].a
== 0 && ss
[1].b
== 0 && ss
[1].c
== 0 &&
491 !strcmp (ss
[1].d
, "TEST2") &&
492 ss
[1].e
== 100 && ss
[1].f
== 2.5 && ss
[1].g
== 43 && ss
[1].h
== (guint64
)124))
498 typedef struct long_align_struct
{
505 mono_test_marshal_long_align_struct_array (long_align_struct
*ss
)
507 return ss
[0].a
+ ss
[0].b
+ ss
[0].c
+ ss
[1].a
+ ss
[1].b
+ ss
[1].c
;
510 STDCALL simplestruct2
*
511 mono_test_marshal_class (int i
, int j
, int k
, simplestruct2
*ss
, int l
)
518 if (i
!= 10 || j
!= 11 || k
!= 12 || l
!= 14)
520 if (! (ss
->a
== 0 && ss
->b
== 1 && ss
->c
== 0 &&
521 !strcmp (ss
->d
, "TEST") &&
522 ss
->e
== 99 && ss
->f
== 1.5 && ss
->g
== 42 && ss
->h
== (guint64
)123))
525 res
= g_new0 (simplestruct2
, 1);
526 memcpy (res
, ss
, sizeof (simplestruct2
));
527 res
->d
= g_strdup ("TEST");
532 mono_test_marshal_byref_class (simplestruct2
**ssp
)
534 simplestruct2
*ss
= *ssp
;
537 if (! (ss
->a
== 0 && ss
->b
== 1 && ss
->c
== 0 &&
538 !strcmp (ss
->d
, "TEST") &&
539 ss
->e
== 99 && ss
->f
== 1.5 && ss
->g
== 42 && ss
->h
== (guint64
)123))
542 res
= g_new0 (simplestruct2
, 1);
543 memcpy (res
, ss
, sizeof (simplestruct2
));
544 res
->d
= g_strdup ("TEST-RES");
556 /* Yes, this is correct, we are only trying to determine the value of the stack here */
562 reliable_delegate (int a
)
568 * Checks whether get_sp() works as expected. It doesn't work with gcc-2.95.3 on linux.
571 is_get_sp_reliable (void)
575 reliable_delegate(1);
577 reliable_delegate(1);
583 mono_test_marshal_delegate (SimpleDelegate delegate
)
587 /* Check that the delegate wrapper is stdcall */
592 if (is_get_sp_reliable())
593 g_assert (sp1
== sp2
);
598 STDCALL SimpleDelegate
599 mono_test_marshal_return_delegate (SimpleDelegate delegate
)
605 return_plus_one (int i
)
610 STDCALL SimpleDelegate
611 mono_test_marshal_return_delegate_2 ()
613 return return_plus_one
;
616 typedef simplestruct (STDCALL
*SimpleDelegate2
) (simplestruct ss
);
619 is_utf16_equals (gunichar2
*s1
, const char *s2
)
624 s
= g_utf16_to_utf8 (s1
, -1, NULL
, NULL
, NULL
);
625 res
= strcmp (s
, s2
);
632 mono_test_marshal_delegate2 (SimpleDelegate2 delegate
)
634 simplestruct ss
, res
;
640 ss
.d2
= g_utf8_to_utf16 ("TEST2", -1, NULL
, NULL
, NULL
);
643 if (! (res
.a
&& !res
.b
&& res
.c
&& !strcmp (res
.d
, "TEST-RES") && is_utf16_equals (res
.d2
, "TEST2-RES")))
649 typedef simplestruct
* (STDCALL
*SimpleDelegate4
) (simplestruct
*ss
);
652 mono_test_marshal_delegate4 (SimpleDelegate4 delegate
)
663 res
= delegate (&ss
);
667 /* Check return value */
668 if (! (!res
->a
&& res
->b
&& !res
->c
&& !strcmp (res
->d
, "TEST")))
671 /* Check NULL argument and NULL result */
672 res
= delegate (NULL
);
679 typedef int (STDCALL
*SimpleDelegate5
) (simplestruct
**ss
);
682 mono_test_marshal_delegate5 (SimpleDelegate5 delegate
)
695 res
= delegate (&ptr
);
699 if (!(ptr
->a
&& !ptr
->b
&& ptr
->c
&& !strcmp (ptr
->d
, "RES")))
706 mono_test_marshal_delegate6 (SimpleDelegate5 delegate
)
710 res
= delegate (NULL
);
715 typedef int (STDCALL
*SimpleDelegate7
) (simplestruct
**ss
);
718 mono_test_marshal_delegate7 (SimpleDelegate7 delegate
)
723 /* Check that the input pointer is ignored */
724 ptr
= (gpointer
)0x12345678;
726 res
= delegate (&ptr
);
730 if (!(ptr
->a
&& !ptr
->b
&& ptr
->c
&& !strcmp (ptr
->d
, "RES")))
736 typedef int (STDCALL
*InOutByvalClassDelegate
) (simplestruct
*ss
);
739 mono_test_marshal_inout_byval_class_delegate (InOutByvalClassDelegate delegate
)
747 ss
.d
= g_strdup_printf ("%s", "FOO");
749 res
= delegate (&ss
);
753 if (!(ss
.a
&& !ss
.b
&& ss
.c
&& !strcmp (ss
.d
, "RES")))
759 typedef int (STDCALL
*SimpleDelegate8
) (gunichar2
*s
);
762 mono_test_marshal_delegate8 (SimpleDelegate8 delegate
, gunichar2
*s
)
767 typedef int (STDCALL
*return_int_fnt
) (int i
);
768 typedef int (STDCALL
*SimpleDelegate9
) (return_int_fnt d
);
771 mono_test_marshal_delegate9 (SimpleDelegate9 delegate
, gpointer ftn
)
773 return delegate (ftn
);
783 mono_test_marshal_delegate10 (SimpleDelegate9 delegate
)
785 return delegate (return_self
);
788 typedef int (STDCALL
*PrimitiveByrefDelegate
) (int *i
);
791 mono_test_marshal_primitive_byref_delegate (PrimitiveByrefDelegate delegate
)
795 int res
= delegate (&i
);
805 typedef int (STDCALL
*return_int_delegate
) (int i
);
807 typedef return_int_delegate (STDCALL
*ReturnDelegateDelegate
) (void);
810 mono_test_marshal_return_delegate_delegate (ReturnDelegateDelegate d
)
816 mono_test_marshal_stringbuilder (char *s
, int n
)
818 const char m
[] = "This is my message. Isn't it nice?";
820 if (strcmp (s
, "ABCD") != 0)
828 mono_test_marshal_stringbuilder_default (char *s
, int n
)
830 const char m
[] = "This is my message. Isn't it nice?";
838 mono_test_marshal_stringbuilder_unicode (gunichar2
*s
, int n
)
840 const char m
[] = "This is my message. Isn't it nice?";
844 s2
= g_utf8_to_utf16 (m
, -1, NULL
, &len
, NULL
);
863 mono_test_marshal_empty_string_array (char **array
)
865 return (array
== NULL
) ? 0 : 1;
869 mono_test_marshal_string_array (char **array
)
871 if (strcmp (array
[0], "ABC"))
873 if (strcmp (array
[1], "DEF"))
876 if (array
[2] != NULL
)
883 mono_test_marshal_byref_string_array (char ***array
)
888 if (strcmp ((*array
) [0], "Alpha"))
890 if (strcmp ((*array
) [1], "Beta"))
892 if (strcmp ((*array
) [2], "Gamma"))
899 mono_test_marshal_stringbuilder_array (char **array
)
901 if (strcmp (array
[0], "ABC"))
903 if (strcmp (array
[1], "DEF"))
906 strcpy (array
[0], "DEF");
907 strcpy (array
[1], "ABC");
913 mono_test_marshal_unicode_string_array (gunichar2
**array
, char **array2
)
915 GError
*error
= NULL
;
918 s
= g_utf16_to_utf8 (array
[0], -1, NULL
, NULL
, &error
);
919 if (strcmp (s
, "ABC")) {
926 s
= g_utf16_to_utf8 (array
[1], -1, NULL
, NULL
, &error
);
927 if (strcmp (s
, "DEF")) {
934 if (strcmp (array2
[0], "ABC"))
937 if (strcmp (array2
[1], "DEF"))
943 /* this does not work on Redhat gcc 2.96 */
945 mono_test_empty_struct (int a
, EmptyStruct es
, int b
)
947 // printf ("mono_test_empty_struct %d %d\n", a, b);
949 // Intel icc on ia64 passes 'es' in 2 registers
950 #if defined(__ia64) && defined(__INTEL_COMPILER)
953 if (a
== 1 && b
== 2)
963 STDCALL ByValStrStruct
*
964 mono_test_byvalstr_gen (void)
968 ret
= malloc(sizeof(ByValStrStruct
));
969 memset(ret
, 'a', sizeof(ByValStrStruct
)-1);
970 ret
->a
[sizeof(ByValStrStruct
)-1] = 0;
976 mono_test_byvalstr_check (ByValStrStruct
* data
, char* correctString
)
980 ret
= strcmp(data
->a
, correctString
);
981 // printf ("T1: %s\n", data->a);
982 // printf ("T2: %s\n", correctString);
991 } ByValStrStruct_Unicode
;
994 mono_test_byvalstr_check_unicode (ByValStrStruct_Unicode
*ref
, int test
)
996 if (ref
->flag
!= 0x1234abcd){
997 printf ("overwritten data");
1001 if (test
== 1 || test
== 3){
1002 if (ref
->a
[0] != '1' ||
1003 ref
->a
[1] != '2' ||
1009 if (ref
->a
[0] != '1' ||
1018 NameManglingAnsi (char *data
)
1020 return data
[0] + data
[1] + data
[2];
1024 NameManglingAnsiA (char *data
)
1026 g_assert_not_reached ();
1030 NameManglingAnsiW (char *data
)
1032 g_assert_not_reached ();
1036 NameManglingAnsi2A (char *data
)
1038 return data
[0] + data
[1] + data
[2];
1042 NameManglingAnsi2W (char *data
)
1044 g_assert_not_reached ();
1048 NameManglingUnicode (char *data
)
1050 g_assert_not_reached ();
1054 NameManglingUnicodeW (gunichar2
*data
)
1056 return data
[0] + data
[1] + data
[2];
1060 NameManglingUnicode2 (gunichar2
*data
)
1062 return data
[0] + data
[1] + data
[2];
1066 NameManglingAutoW (char *data
)
1069 return (data
[0] + data
[1] + data
[2]) == 131 ? 0 : 1;
1071 g_assert_not_reached ();
1076 NameManglingAuto (char *data
)
1079 return (data
[0] + data
[1] + data
[2]) == 198 ? 0 : 1;
1081 g_assert_not_reached ();
1085 typedef int (STDCALL
*intcharFunc
)(const char*);
1088 callFunction (intcharFunc f
)
1099 class_marshal_test0 (SimpleObj
*obj1
)
1101 // printf ("class_marshal_test0 %s %d\n", obj1->str, obj1->i);
1103 if (strcmp(obj1
->str
, "T1"))
1112 class_marshal_test4 (SimpleObj
*obj1
)
1121 class_marshal_test1 (SimpleObj
**obj1
)
1123 SimpleObj
*res
= malloc (sizeof (SimpleObj
));
1125 res
->str
= g_strdup ("ABC");
1132 class_marshal_test2 (SimpleObj
**obj1
)
1134 // printf ("class_marshal_test2 %s %d\n", (*obj1)->str, (*obj1)->i);
1136 if (strcmp((*obj1
)->str
, "ABC"))
1138 if ((*obj1
)->i
!= 5)
1145 string_marshal_test0 (char *str
)
1147 if (strcmp (str
, "TEST0"))
1154 string_marshal_test1 (const char **str
)
1160 string_marshal_test2 (char **str
)
1162 // printf ("string_marshal_test2 %s\n", *str);
1164 if (strcmp (*str
, "TEST1"))
1171 string_marshal_test3 (char *str
)
1184 STDCALL BlittableClass
*
1185 TestBlittableClass (BlittableClass
*vl
)
1187 BlittableClass
*res
;
1189 // printf ("TestBlittableClass %d %d\n", vl->a, vl->b);
1195 res
= g_new0 (BlittableClass
, 1);
1196 memcpy (res
, vl
, sizeof (BlittableClass
));
1198 res
= g_new0 (BlittableClass
, 1);
1206 typedef struct OSVERSIONINFO_STRUCT
1210 } OSVERSIONINFO_STRUCT
;
1213 MyGetVersionEx (OSVERSIONINFO_STRUCT
*osvi
)
1216 // printf ("GOT %d %d\n", osvi->a, osvi->b);
1221 return osvi
->a
+ osvi
->b
;
1225 BugGetVersionEx (int a
, int b
, int c
, int d
, int e
, int f
, int g
, int h
, OSVERSIONINFO_STRUCT
*osvi
)
1228 // printf ("GOT %d %d\n", osvi->a, osvi->b);
1233 return osvi
->a
+ osvi
->b
;
1237 mono_test_marshal_point (point pt
)
1239 // printf("point %g %g\n", pt.x, pt.y);
1240 if (pt
.x
== 1.25 && pt
.y
== 3.5)
1252 mono_test_marshal_mixed_point (mixed_point pt
)
1254 // printf("mixed point %d %g\n", pt.x, pt.y);
1255 if (pt
.x
== 5 && pt
.y
== 6.75)
1262 mono_test_marshal_mixed_point_2 (mixed_point
*pt
)
1264 if (pt
->x
!= 5 || pt
->y
!= 6.75)
1274 marshal_test_ref_bool(int i
, char *b1
, short *b2
, int *b3
)
1277 if (*b1
!= 0 && *b1
!= 1)
1279 if (*b2
!= 0 && *b2
!= -1) /* variant_bool */
1281 if (*b3
!= 0 && *b3
!= 1)
1283 if (i
== ((*b1
<< 2) | (-*b2
<< 1) | *b3
))
1295 short b2
; /* variant_bool */
1300 marshal_test_bool_struct(struct BoolStruct
*s
)
1303 if (s
->b1
!= 0 && s
->b1
!= 1)
1305 if (s
->b2
!= 0 && s
->b2
!= -1)
1307 if (s
->b3
!= 0 && s
->b3
!= 1)
1309 if (s
->i
== ((s
->b1
<< 2) | (-s
->b2
<< 1) | s
->b3
))
1318 mono_test_last_error (int err
)
1328 mono_test_asany (void *ptr
, int what
)
1332 return (*(int*)ptr
== 5) ? 0 : 1;
1334 return strcmp (ptr
, "ABC") == 0 ? 0 : 1;
1336 simplestruct2 ss
= *(simplestruct2
*)ptr
;
1338 if (ss
.a
== 0 && ss
.b
== 1 && ss
.c
== 0 &&
1339 !strcmp (ss
.d
, "TEST") &&
1340 ss
.e
== 99 && ss
.f
== 1.5 && ss
.g
== 42 && ss
.h
== (guint64
)123)
1346 GError
*error
= NULL
;
1349 s
= g_utf16_to_utf8 (ptr
, -1, NULL
, NULL
, &error
);
1350 if (!strcmp (s
, "ABC")) {
1360 g_assert_not_reached ();
1375 mono_test_marshal_asany_inout (void* ptr
)
1377 AsAnyStruct
* asAny
= ptr
;
1378 int res
= asAny
->i
+ asAny
->j
+ asAny
->k
;
1389 * AMD64 marshalling tests.
1392 typedef struct amd64_struct1
{
1399 STDCALL amd64_struct1
1400 mono_test_marshal_amd64_pass_return_struct1 (amd64_struct1 s
)
1410 typedef struct amd64_struct2
{
1415 STDCALL amd64_struct2
1416 mono_test_marshal_amd64_pass_return_struct2 (amd64_struct2 s
)
1424 typedef struct amd64_struct3
{
1428 STDCALL amd64_struct3
1429 mono_test_marshal_amd64_pass_return_struct3 (amd64_struct3 s
)
1436 typedef struct amd64_struct4
{
1440 STDCALL amd64_struct4
1441 mono_test_marshal_amd64_pass_return_struct4 (amd64_struct4 s
)
1450 * IA64 marshalling tests.
1452 typedef struct test_struct5
{
1456 STDCALL test_struct5
1457 mono_test_marshal_ia64_pass_return_struct5 (double d1
, double d2
, test_struct5 s
, double d3
, double d4
)
1465 typedef struct test_struct6
{
1469 STDCALL test_struct6
1470 mono_test_marshal_ia64_pass_return_struct6 (double d1
, double d2
, test_struct6 s
, double d3
, double d4
)
1478 static guint32 custom_res
[2];
1481 mono_test_marshal_pass_return_custom (int i
, guint32
*ptr
, int j
)
1483 /* ptr will be freed by CleanupNative, so make a copy */
1484 custom_res
[0] = 0; /* not allocated by AllocHGlobal */
1485 custom_res
[1] = ptr
[1];
1491 mono_test_marshal_pass_out_custom (int i
, guint32
**ptr
, int j
)
1494 custom_res
[1] = i
+ j
+ 10;
1502 mono_test_marshal_pass_inout_custom (int i
, guint32
*ptr
, int j
)
1505 ptr
[1] = i
+ ptr
[1] + j
;
1511 mono_test_marshal_pass_out_byval_custom (int i
, guint32
*ptr
, int j
)
1513 return ptr
== NULL
? 0 : 1;
1517 mono_test_marshal_pass_byref_custom (int i
, guint32
**ptr
, int j
)
1525 mono_test_marshal_pass_return_custom2 (int i
, guint32
*ptr
, int j
)
1527 g_assert_not_reached ();
1533 mono_test_marshal_pass_return_custom_null (int i
, guint32
*ptr
, int j
)
1535 g_assert (ptr
== NULL
);
1540 typedef void *(STDCALL
*PassReturnPtrDelegate
) (void *ptr
);
1543 mono_test_marshal_pass_return_custom_in_delegate (PassReturnPtrDelegate del
)
1557 /* FIXME: Freed with FreeHGlobal */
1566 mono_test_marshal_pass_return_custom_null_in_delegate (PassReturnPtrDelegate del
)
1568 void *ptr
= del (NULL
);
1570 return (ptr
== NULL
) ? 15 : 0;
1573 typedef int (STDCALL
*ReturnEnumDelegate
) (int e
);
1576 mono_test_marshal_return_enum_delegate (ReturnEnumDelegate func
)
1586 typedef BlittableStruct (STDCALL
*SimpleDelegate10
) (BlittableStruct ss
);
1589 mono_test_marshal_blittable_struct_delegate (SimpleDelegate10 delegate
)
1591 BlittableStruct ss
, res
;
1598 res
= delegate (ss
);
1599 if (! ((res
.a
== -1) && (res
.b
== -2) && (res
.c
== -3) && (res
.d
== -55)))
1606 mono_test_stdcall_name_mangling (int a
, int b
, int c
)
1612 * PASSING AND RETURNING SMALL STRUCTURES FROM DELEGATES TESTS
1619 typedef SmallStruct1 (STDCALL
*SmallStructDelegate1
) (SmallStruct1 ss
);
1622 mono_test_marshal_small_struct_delegate1 (SmallStructDelegate1 delegate
)
1624 SmallStruct1 ss
, res
;
1628 res
= delegate (ss
);
1629 if (! (res
.i
== -1))
1639 typedef SmallStruct2 (STDCALL
*SmallStructDelegate2
) (SmallStruct2 ss
);
1642 mono_test_marshal_small_struct_delegate2 (SmallStructDelegate2 delegate
)
1644 SmallStruct2 ss
, res
;
1649 res
= delegate (ss
);
1650 if (! ((res
.i
== -2) && (res
.j
== -3)))
1661 typedef SmallStruct3 (STDCALL
*SmallStructDelegate3
) (SmallStruct3 ss
);
1664 mono_test_marshal_small_struct_delegate3 (SmallStructDelegate3 delegate
)
1666 SmallStruct3 ss
, res
;
1671 res
= delegate (ss
);
1672 if (! ((res
.i
== -1) && (res
.j
== -2)))
1682 typedef SmallStruct4 (STDCALL
*SmallStructDelegate4
) (SmallStruct4 ss
);
1685 mono_test_marshal_small_struct_delegate4 (SmallStructDelegate4 delegate
)
1687 SmallStruct4 ss
, res
;
1691 res
= delegate (ss
);
1692 if (! (res
.i
== -1))
1702 typedef SmallStruct5 (STDCALL
*SmallStructDelegate5
) (SmallStruct5 ss
);
1705 mono_test_marshal_small_struct_delegate5 (SmallStructDelegate5 delegate
)
1707 SmallStruct5 ss
, res
;
1711 res
= delegate (ss
);
1712 if (! (res
.i
== -5))
1722 typedef SmallStruct6 (STDCALL
*SmallStructDelegate6
) (SmallStruct6 ss
);
1725 mono_test_marshal_small_struct_delegate6 (SmallStructDelegate6 delegate
)
1727 SmallStruct6 ss
, res
;
1732 res
= delegate (ss
);
1733 if (! ((res
.i
== -1) && (res
.j
== -2)))
1744 typedef SmallStruct7 (STDCALL
*SmallStructDelegate7
) (SmallStruct7 ss
);
1747 mono_test_marshal_small_struct_delegate7 (SmallStructDelegate7 delegate
)
1749 SmallStruct7 ss
, res
;
1754 res
= delegate (ss
);
1755 if (! ((res
.i
== -1) && (res
.j
== -2)))
1765 typedef SmallStruct8 (STDCALL
*SmallStructDelegate8
) (SmallStruct8 ss
);
1768 mono_test_marshal_small_struct_delegate8 (SmallStructDelegate8 delegate
)
1770 SmallStruct8 ss
, res
;
1774 res
= delegate (ss
);
1775 if (! ((res
.i
== -1.0)))
1785 typedef SmallStruct9 (STDCALL
*SmallStructDelegate9
) (SmallStruct9 ss
);
1788 mono_test_marshal_small_struct_delegate9 (SmallStructDelegate9 delegate
)
1790 SmallStruct9 ss
, res
;
1794 res
= delegate (ss
);
1795 if (! ((res
.i
== -1.0)))
1805 typedef SmallStruct10 (STDCALL
*SmallStructDelegate10
) (SmallStruct10 ss
);
1808 mono_test_marshal_small_struct_delegate10 (SmallStructDelegate10 delegate
)
1810 SmallStruct10 ss
, res
;
1815 res
= delegate (ss
);
1816 if (! ((res
.i
== -1.0) && (res
.j
== -2.0)))
1827 typedef SmallStruct11 (STDCALL
*SmallStructDelegate11
) (SmallStruct11 ss
);
1830 mono_test_marshal_small_struct_delegate11 (SmallStructDelegate11 delegate
)
1832 SmallStruct11 ss
, res
;
1837 res
= delegate (ss
);
1838 if (! ((res
.i
== -1.0) && (res
.j
== -2)))
1844 typedef int (STDCALL
*ArrayDelegate
) (int i
, char *j
, void *arr
);
1847 mono_test_marshal_array_delegate (void *arr
, int len
, ArrayDelegate del
)
1849 return del (len
, NULL
, arr
);
1853 mono_test_marshal_out_array_delegate (int *arr
, int len
, ArrayDelegate del
)
1855 del (len
, NULL
, arr
);
1857 if ((arr
[0] != 1) || (arr
[1] != 2))
1864 mono_test_marshal_out_string_array_delegate (char **arr
, int len
, ArrayDelegate del
)
1866 del (len
, NULL
, arr
);
1868 if (!strcmp (arr
[0], "ABC") && !strcmp (arr
[1], "DEF"))
1874 typedef int (*CdeclDelegate
) (int i
, int j
);
1877 mono_test_marshal_cdecl_delegate (CdeclDelegate del
)
1881 for (i
= 0; i
< 1000; ++i
)
1887 typedef char** (*ReturnStringArrayDelegate
) (int i
);
1890 mono_test_marshal_return_string_array_delegate (ReturnStringArrayDelegate d
)
1898 if (strcmp (arr
[0], "ABC") || strcmp (arr
[1], "DEF"))
1909 add_delegate (int i
, int j
)
1915 mono_test_marshal_return_fnptr (void)
1917 return &add_delegate
;
1920 STDCALL
int mono_xr (int code
)
1922 printf ("codigo %x\n", code
);
1934 mono_safe_handle_struct_ref (HandleStructs
*x
)
1936 printf ("Dingus Ref! \n");
1937 printf ("Values: %d %d %d %d\n", x
->a
, x
->b
, x
->handle1
, x
->handle2
);
1943 if (x
->handle1
!= (void*) 0x7080feed)
1946 if (x
->handle2
!= (void*) 0x1234abcd)
1953 mono_safe_handle_struct (HandleStructs x
)
1955 printf ("Dingus Standard! \n");
1956 printf ("Values: %d %d %d %d\n", x
.a
, x
.b
, x
.handle1
, x
.handle2
);
1962 if (x
.handle1
!= (void*) 0x7080feed)
1965 if (x
.handle2
!= (void*) 0x1234abcd)
1976 mono_safe_handle_struct_simple (TrivialHandle x
)
1978 printf ("The value is %d\n", x
.a
);
1979 return ((int)x
.a
) * 2;
1983 mono_safe_handle_return ()
1989 mono_safe_handle_ref (void **handle
)
1992 *handle
= (void *) 0xbad;
1996 *handle
= (void *) 0x800d;
2005 mono_test_marshal_bstr_in(BSTR bstr
)
2007 if (!wcscmp(bstr
, L
"mono_test_marshal_bstr_in"))
2013 mono_test_marshal_bstr_out(BSTR
* bstr
)
2015 *bstr
= SysAllocString(L
"mono_test_marshal_bstr_out");
2020 mono_test_marshal_bstr_in_null(BSTR bstr
)
2028 mono_test_marshal_bstr_out_null(BSTR
* bstr
)
2035 mono_test_marshal_variant_in_sbyte(VARIANT variant
)
2037 if (variant
.vt
== VT_I1
&& variant
.cVal
== 100)
2043 mono_test_marshal_variant_in_byte(VARIANT variant
)
2045 if (variant
.vt
== VT_UI1
&& variant
.bVal
== 100)
2051 mono_test_marshal_variant_in_short(VARIANT variant
)
2053 if (variant
.vt
== VT_I2
&& variant
.iVal
== 314)
2059 mono_test_marshal_variant_in_ushort(VARIANT variant
)
2061 if (variant
.vt
== VT_UI2
&& variant
.uiVal
== 314)
2067 mono_test_marshal_variant_in_int(VARIANT variant
)
2069 if (variant
.vt
== VT_I4
&& variant
.lVal
== 314)
2075 mono_test_marshal_variant_in_uint(VARIANT variant
)
2077 if (variant
.vt
== VT_UI4
&& variant
.ulVal
== 314)
2083 mono_test_marshal_variant_in_long(VARIANT variant
)
2085 if (variant
.vt
== VT_I8
&& variant
.llVal
== 314)
2091 mono_test_marshal_variant_in_ulong(VARIANT variant
)
2093 if (variant
.vt
== VT_UI8
&& variant
.ullVal
== 314)
2099 mono_test_marshal_variant_in_float(VARIANT variant
)
2101 if (variant
.vt
== VT_R4
&& (variant
.fltVal
- 3.14)/3.14 < .001)
2107 mono_test_marshal_variant_in_double(VARIANT variant
)
2109 if (variant
.vt
== VT_R8
&& (variant
.dblVal
- 3.14)/3.14 < .001)
2115 mono_test_marshal_variant_in_bstr(VARIANT variant
)
2117 if (variant
.vt
== VT_BSTR
&& !wcscmp(variant
.bstrVal
, L
"PI"))
2123 mono_test_marshal_variant_in_bool_true (VARIANT variant
)
2125 if (variant
.vt
== VT_BOOL
&& variant
.boolVal
== VARIANT_TRUE
)
2131 mono_test_marshal_variant_in_bool_false (VARIANT variant
)
2133 if (variant
.vt
== VT_BOOL
&& variant
.boolVal
== VARIANT_FALSE
)
2139 mono_test_marshal_variant_out_sbyte(VARIANT
* variant
)
2141 variant
->vt
= VT_I1
;
2142 variant
->cVal
= 100;
2148 mono_test_marshal_variant_out_byte(VARIANT
* variant
)
2150 variant
->vt
= VT_UI1
;
2151 variant
->bVal
= 100;
2157 mono_test_marshal_variant_out_short(VARIANT
* variant
)
2159 variant
->vt
= VT_I2
;
2160 variant
->iVal
= 314;
2166 mono_test_marshal_variant_out_ushort(VARIANT
* variant
)
2168 variant
->vt
= VT_UI2
;
2169 variant
->uiVal
= 314;
2175 mono_test_marshal_variant_out_int(VARIANT
* variant
)
2177 variant
->vt
= VT_I4
;
2178 variant
->lVal
= 314;
2184 mono_test_marshal_variant_out_uint(VARIANT
* variant
)
2186 variant
->vt
= VT_UI4
;
2187 variant
->ulVal
= 314;
2193 mono_test_marshal_variant_out_long(VARIANT
* variant
)
2195 variant
->vt
= VT_I8
;
2196 variant
->llVal
= 314;
2202 mono_test_marshal_variant_out_ulong(VARIANT
* variant
)
2204 variant
->vt
= VT_UI8
;
2205 variant
->ullVal
= 314;
2211 mono_test_marshal_variant_out_float(VARIANT
* variant
)
2213 variant
->vt
= VT_R4
;
2214 variant
->fltVal
= 3.14;
2220 mono_test_marshal_variant_out_double(VARIANT
* variant
)
2222 variant
->vt
= VT_R8
;
2223 variant
->dblVal
= 3.14;
2229 mono_test_marshal_variant_out_bstr(VARIANT
* variant
)
2231 variant
->vt
= VT_BSTR
;
2232 variant
->bstrVal
= SysAllocString(L
"PI");
2238 mono_test_marshal_variant_out_bool_true (VARIANT
* variant
)
2240 variant
->vt
= VT_BOOL
;
2241 variant
->boolVal
= VARIANT_TRUE
;
2247 mono_test_marshal_variant_out_bool_false (VARIANT
* variant
)
2249 variant
->vt
= VT_BOOL
;
2250 variant
->boolVal
= VARIANT_FALSE
;
2255 typedef int (STDCALL
*VarFunc
) (int vt
, VARIANT variant
);
2256 typedef int (STDCALL
*VarRefFunc
) (int vt
, VARIANT
* variant
);
2259 mono_test_marshal_variant_in_sbyte_unmanaged(VarFunc func
)
2264 return func (VT_I1
, vt
);
2268 mono_test_marshal_variant_in_byte_unmanaged(VarFunc func
)
2273 return func (VT_UI1
, vt
);
2277 mono_test_marshal_variant_in_short_unmanaged(VarFunc func
)
2282 return func (VT_I2
, vt
);
2286 mono_test_marshal_variant_in_ushort_unmanaged(VarFunc func
)
2291 return func (VT_UI2
, vt
);
2295 mono_test_marshal_variant_in_int_unmanaged(VarFunc func
)
2300 return func (VT_I4
, vt
);
2304 mono_test_marshal_variant_in_uint_unmanaged(VarFunc func
)
2309 return func (VT_UI4
, vt
);
2313 mono_test_marshal_variant_in_long_unmanaged(VarFunc func
)
2318 return func (VT_I8
, vt
);
2322 mono_test_marshal_variant_in_ulong_unmanaged(VarFunc func
)
2327 return func (VT_UI8
, vt
);
2331 mono_test_marshal_variant_in_float_unmanaged(VarFunc func
)
2336 return func (VT_R4
, vt
);
2340 mono_test_marshal_variant_in_double_unmanaged(VarFunc func
)
2345 return func (VT_R8
, vt
);
2349 mono_test_marshal_variant_in_bstr_unmanaged(VarFunc func
)
2353 vt
.bstrVal
= SysAllocString(L
"PI");
2354 return func (VT_BSTR
, vt
);
2358 mono_test_marshal_variant_in_bool_true_unmanaged(VarFunc func
)
2362 vt
.boolVal
= VARIANT_TRUE
;
2363 return func (VT_BOOL
, vt
);
2367 mono_test_marshal_variant_in_bool_false_unmanaged(VarFunc func
)
2371 vt
.boolVal
= VARIANT_FALSE
;
2372 return func (VT_BOOL
, vt
);
2376 mono_test_marshal_variant_out_sbyte_unmanaged(VarRefFunc func
)
2381 if (vt
.vt
== VT_I1
&& vt
.cVal
== -100)
2387 mono_test_marshal_variant_out_byte_unmanaged(VarRefFunc func
)
2392 if (vt
.vt
== VT_UI1
&& vt
.bVal
== 100)
2398 mono_test_marshal_variant_out_short_unmanaged(VarRefFunc func
)
2403 if (vt
.vt
== VT_I2
&& vt
.iVal
== -100)
2409 mono_test_marshal_variant_out_ushort_unmanaged(VarRefFunc func
)
2414 if (vt
.vt
== VT_UI2
&& vt
.uiVal
== 100)
2420 mono_test_marshal_variant_out_int_unmanaged(VarRefFunc func
)
2425 if (vt
.vt
== VT_I4
&& vt
.lVal
== -100)
2431 mono_test_marshal_variant_out_uint_unmanaged(VarRefFunc func
)
2436 if (vt
.vt
== VT_UI4
&& vt
.ulVal
== 100)
2442 mono_test_marshal_variant_out_long_unmanaged(VarRefFunc func
)
2447 if (vt
.vt
== VT_I8
&& vt
.llVal
== -100)
2453 mono_test_marshal_variant_out_ulong_unmanaged(VarRefFunc func
)
2458 if (vt
.vt
== VT_UI8
&& vt
.ullVal
== 100)
2464 mono_test_marshal_variant_out_float_unmanaged(VarRefFunc func
)
2469 if (vt
.vt
== VT_R4
&& fabs (vt
.fltVal
- 3.14f
) < 1e-10)
2475 mono_test_marshal_variant_out_double_unmanaged(VarRefFunc func
)
2480 if (vt
.vt
== VT_R8
&& fabs (vt
.dblVal
- 3.14) < 1e-10)
2486 mono_test_marshal_variant_out_bstr_unmanaged(VarRefFunc func
)
2490 func (VT_BSTR
, &vt
);
2491 if (vt
.vt
== VT_BSTR
&& !wcscmp(vt
.bstrVal
, L
"PI"))
2497 mono_test_marshal_variant_out_bool_true_unmanaged(VarRefFunc func
)
2501 func (VT_BOOL
, &vt
);
2502 if (vt
.vt
== VT_BOOL
&& vt
.boolVal
== VARIANT_TRUE
)
2508 mono_test_marshal_variant_out_bool_false_unmanaged(VarRefFunc func
)
2512 func (VT_BOOL
, &vt
);
2513 if (vt
.vt
== VT_BOOL
&& vt
.boolVal
== VARIANT_TRUE
)
2518 typedef struct MonoComObject MonoComObject
;
2522 int (STDCALL
*QueryInterface
)(MonoComObject
* pUnk
, gpointer riid
, gpointer
* ppv
);
2523 int (STDCALL
*AddRef
)(MonoComObject
* pUnk
);
2524 int (STDCALL
*Release
)(MonoComObject
* pUnk
);
2525 int (STDCALL
*get_ITest
)(MonoComObject
* pUnk
, MonoComObject
* *ppUnk
);
2526 int (STDCALL
*SByteIn
)(MonoComObject
* pUnk
, char a
);
2527 int (STDCALL
*ByteIn
)(MonoComObject
* pUnk
, unsigned char a
);
2528 int (STDCALL
*ShortIn
)(MonoComObject
* pUnk
, short a
);
2529 int (STDCALL
*UShortIn
)(MonoComObject
* pUnk
, unsigned short a
);
2530 int (STDCALL
*IntIn
)(MonoComObject
* pUnk
, int a
);
2531 int (STDCALL
*UIntIn
)(MonoComObject
* pUnk
, unsigned int a
);
2532 int (STDCALL
*LongIn
)(MonoComObject
* pUnk
, LONGLONG a
);
2533 int (STDCALL
*ULongIn
)(MonoComObject
* pUnk
, ULONGLONG a
);
2534 int (STDCALL
*FloatIn
)(MonoComObject
* pUnk
, float a
);
2535 int (STDCALL
*DoubleIn
)(MonoComObject
* pUnk
, double a
);
2536 int (STDCALL
*ITestIn
)(MonoComObject
* pUnk
, MonoComObject
* pUnk2
);
2537 int (STDCALL
*ITestOut
)(MonoComObject
* pUnk
, MonoComObject
* *ppUnk
);
2540 struct MonoComObject
2546 DEFINE_GUID(IID_ITest
, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
2547 DEFINE_GUID(IID_IMonoUnknown
, 0, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46);
2548 DEFINE_GUID(IID_IMonoDispatch
, 0x00020400, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46);
2550 int STDCALL
MonoQueryInterface(MonoComObject
* pUnk
, gpointer riid
, gpointer
* ppv
)
2553 if (!memcmp(riid
, &IID_IMonoUnknown
, sizeof(GUID
))) {
2557 else if (!memcmp(riid
, &IID_ITest
, sizeof(GUID
))) {
2561 else if (!memcmp(riid
, &IID_IMonoDispatch
, sizeof(GUID
))) {
2565 return E_NOINTERFACE
;
2568 int STDCALL
MonoAddRef(MonoComObject
* pUnk
)
2570 return ++(pUnk
->m_ref
);
2573 int STDCALL
MonoRelease(MonoComObject
* pUnk
)
2575 return --(pUnk
->m_ref
);
2578 int STDCALL
SByteIn(MonoComObject
* pUnk
, char a
)
2583 int STDCALL
ByteIn(MonoComObject
* pUnk
, unsigned char a
)
2588 int STDCALL
ShortIn(MonoComObject
* pUnk
, short a
)
2593 int STDCALL
UShortIn(MonoComObject
* pUnk
, unsigned short a
)
2598 int STDCALL
IntIn(MonoComObject
* pUnk
, int a
)
2603 int STDCALL
UIntIn(MonoComObject
* pUnk
, unsigned int a
)
2608 int STDCALL
LongIn(MonoComObject
* pUnk
, LONGLONG a
)
2613 int STDCALL
ULongIn(MonoComObject
* pUnk
, ULONGLONG a
)
2618 int STDCALL
FloatIn(MonoComObject
* pUnk
, float a
)
2623 int STDCALL
DoubleIn(MonoComObject
* pUnk
, double a
)
2628 int STDCALL
ITestIn(MonoComObject
* pUnk
, MonoComObject
*pUnk2
)
2633 int STDCALL
ITestOut(MonoComObject
* pUnk
, MonoComObject
* *ppUnk
)
2638 int STDCALL
get_ITest(MonoComObject
* pUnk
, MonoComObject
* *ppUnk
)
2643 static void create_com_object (MonoComObject
** pOut
)
2645 *pOut
= g_new0 (MonoComObject
, 1);
2646 (*pOut
)->vtbl
= g_new0 (MonoIUnknown
, 1);
2649 (*pOut
)->vtbl
->QueryInterface
= MonoQueryInterface
;
2650 (*pOut
)->vtbl
->AddRef
= MonoAddRef
;
2651 (*pOut
)->vtbl
->Release
= MonoRelease
;
2652 (*pOut
)->vtbl
->SByteIn
= SByteIn
;
2653 (*pOut
)->vtbl
->ByteIn
= ByteIn
;
2654 (*pOut
)->vtbl
->ShortIn
= ShortIn
;
2655 (*pOut
)->vtbl
->UShortIn
= UShortIn
;
2656 (*pOut
)->vtbl
->IntIn
= IntIn
;
2657 (*pOut
)->vtbl
->UIntIn
= UIntIn
;
2658 (*pOut
)->vtbl
->LongIn
= LongIn
;
2659 (*pOut
)->vtbl
->ULongIn
= ULongIn
;
2660 (*pOut
)->vtbl
->FloatIn
= FloatIn
;
2661 (*pOut
)->vtbl
->DoubleIn
= DoubleIn
;
2662 (*pOut
)->vtbl
->ITestIn
= ITestIn
;
2663 (*pOut
)->vtbl
->ITestOut
= ITestOut
;
2664 (*pOut
)->vtbl
->get_ITest
= get_ITest
;
2667 static MonoComObject
* same_object
= NULL
;
2670 mono_test_marshal_com_object_create(MonoComObject
* *pUnk
)
2672 create_com_object (pUnk
);
2675 same_object
= *pUnk
;
2681 mono_test_marshal_com_object_same(MonoComObject
* *pUnk
)
2683 *pUnk
= same_object
;
2689 mono_test_marshal_com_object_destroy(MonoComObject
*pUnk
)
2691 int ref
= --(pUnk
->m_ref
);
2699 mono_test_marshal_com_object_ref_count(MonoComObject
*pUnk
)
2705 mono_test_marshal_ccw_itest (MonoComObject
*pUnk
)
2708 MonoComObject
* pTest
;
2713 hr
= pUnk
->vtbl
->SByteIn (pUnk
, -100);
2716 hr
= pUnk
->vtbl
->ByteIn (pUnk
, 100);
2719 hr
= pUnk
->vtbl
->ShortIn (pUnk
, -100);
2722 hr
= pUnk
->vtbl
->UShortIn (pUnk
, 100);
2725 hr
= pUnk
->vtbl
->IntIn (pUnk
, -100);
2728 hr
= pUnk
->vtbl
->UIntIn (pUnk
, 100);
2731 hr
= pUnk
->vtbl
->LongIn (pUnk
, -100);
2734 hr
= pUnk
->vtbl
->ULongIn (pUnk
, 100);
2737 hr
= pUnk
->vtbl
->FloatIn (pUnk
, 3.14f
);
2740 hr
= pUnk
->vtbl
->DoubleIn (pUnk
, 3.14);
2743 hr
= pUnk
->vtbl
->ITestIn (pUnk
, pUnk
);
2746 hr
= pUnk
->vtbl
->ITestOut (pUnk
, &pTest
);