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_bool_in_as_I1_U1 (char bTrue
, char bFalse
)
266 mono_test_marshal_bool_out_as_I1_U1 (char* bTrue
, char* bFalse
)
268 if (!bTrue
|| !bFalse
)
278 mono_test_marshal_bool_ref_as_I1_U1 (char* bTrue
, char* bFalse
)
280 if (!bTrue
|| !bFalse
)
295 mono_test_marshal_array (int *a1
)
299 for (i
= 0; i
< 50; i
++)
306 mono_test_marshal_inout_array (int *a1
)
310 for (i
= 0; i
< 50; i
++) {
312 a1
[i
] = 50 - a1
[i
];
319 mono_test_marshal_out_array (int *a1
)
323 for (i
= 0; i
< 50; i
++) {
331 mono_test_marshal_inout_nonblittable_array (gunichar2
*a1
)
335 for (i
= 0; i
< 10; i
++) {
356 mono_test_return_vtype (int i
)
359 static gunichar2 test2
[] = { 'T', 'E', 'S', 'T', '2', 0 };
371 mono_test_delegate_struct (void)
373 // printf ("TEST\n");
376 typedef char* (STDCALL
*ReturnStringDelegate
) (const char *s
);
379 mono_test_return_string (ReturnStringDelegate func
)
383 // printf ("mono_test_return_string\n");
388 // printf ("got string: %s\n", res);
389 return g_strdup ("12345");
392 typedef int (STDCALL
*RefVTypeDelegate
) (int a
, simplestruct
*ss
, int b
);
395 mono_test_ref_vtype (int a
, simplestruct
*ss
, int b
, RefVTypeDelegate func
)
397 if (a
== 1 && b
== 2 && ss
->a
== 0 && ss
->b
== 1 && ss
->c
== 0 &&
398 !strcmp (ss
->d
, "TEST1")) {
404 return func (a
, ss
, b
);
410 typedef int (STDCALL
*OutVTypeDelegate
) (int a
, simplestruct
*ss
, int b
);
413 mono_test_marshal_out_struct (int a
, simplestruct
*ss
, int b
, OutVTypeDelegate func
)
415 /* Check that the input pointer is ignored */
416 ss
->d
= (gpointer
)0x12345678;
420 if (ss
->a
&& ss
->b
&& ss
->c
&& !strcmp (ss
->d
, "TEST3"))
428 SimpleDelegate func
, func2
;
431 STDCALL DelegateStruct
432 mono_test_marshal_delegate_struct (DelegateStruct ds
)
436 res
.a
= ds
.func (ds
.a
) + ds
.func2 (ds
.a
);
438 res
.func2
= ds
.func2
;
444 mono_test_marshal_struct (simplestruct ss
)
446 if (ss
.a
== 0 && ss
.b
== 1 && ss
.c
== 0 &&
447 !strcmp (ss
.d
, "TEST"))
454 mono_test_marshal_byref_struct (simplestruct
*ss
, int a
, int b
, int c
, char *d
)
456 gboolean res
= (ss
->a
== a
&& ss
->b
== b
&& ss
->c
== c
&& strcmp (ss
->d
, d
) == 0);
458 marshal_free (ss
->d
);
463 ss
->d
= g_strdup ("DEF");
480 mono_test_marshal_struct2 (simplestruct2 ss
)
482 if (ss
.a
== 0 && ss
.b
== 1 && ss
.c
== 0 &&
483 !strcmp (ss
.d
, "TEST") &&
484 ss
.e
== 99 && ss
.f
== 1.5 && ss
.g
== 42 && ss
.h
== (guint64
)123)
490 /* on HP some of the struct should be on the stack and not in registers */
492 mono_test_marshal_struct2_2 (int i
, int j
, int k
, simplestruct2 ss
)
494 if (i
!= 10 || j
!= 11 || k
!= 12)
496 if (ss
.a
== 0 && ss
.b
== 1 && ss
.c
== 0 &&
497 !strcmp (ss
.d
, "TEST") &&
498 ss
.e
== 99 && ss
.f
== 1.5 && ss
.g
== 42 && ss
.h
== (guint64
)123)
505 mono_test_marshal_lpstruct (simplestruct
*ss
)
507 if (ss
->a
== 0 && ss
->b
== 1 && ss
->c
== 0 &&
508 !strcmp (ss
->d
, "TEST"))
515 mono_test_marshal_lpstruct_blittable (point
*p
)
517 if (p
->x
== 1.0 && p
->y
== 2.0)
524 mono_test_marshal_struct_array (simplestruct2
*ss
)
526 if (! (ss
[0].a
== 0 && ss
[0].b
== 1 && ss
[0].c
== 0 &&
527 !strcmp (ss
[0].d
, "TEST") &&
528 ss
[0].e
== 99 && ss
[0].f
== 1.5 && ss
[0].g
== 42 && ss
[0].h
== (guint64
)123))
531 if (! (ss
[1].a
== 0 && ss
[1].b
== 0 && ss
[1].c
== 0 &&
532 !strcmp (ss
[1].d
, "TEST2") &&
533 ss
[1].e
== 100 && ss
[1].f
== 2.5 && ss
[1].g
== 43 && ss
[1].h
== (guint64
)124))
539 typedef struct long_align_struct
{
546 mono_test_marshal_long_align_struct_array (long_align_struct
*ss
)
548 return ss
[0].a
+ ss
[0].b
+ ss
[0].c
+ ss
[1].a
+ ss
[1].b
+ ss
[1].c
;
551 STDCALL simplestruct2
*
552 mono_test_marshal_class (int i
, int j
, int k
, simplestruct2
*ss
, int l
)
559 if (i
!= 10 || j
!= 11 || k
!= 12 || l
!= 14)
561 if (! (ss
->a
== 0 && ss
->b
== 1 && ss
->c
== 0 &&
562 !strcmp (ss
->d
, "TEST") &&
563 ss
->e
== 99 && ss
->f
== 1.5 && ss
->g
== 42 && ss
->h
== (guint64
)123))
566 res
= g_new0 (simplestruct2
, 1);
567 memcpy (res
, ss
, sizeof (simplestruct2
));
568 res
->d
= g_strdup ("TEST");
573 mono_test_marshal_byref_class (simplestruct2
**ssp
)
575 simplestruct2
*ss
= *ssp
;
578 if (! (ss
->a
== 0 && ss
->b
== 1 && ss
->c
== 0 &&
579 !strcmp (ss
->d
, "TEST") &&
580 ss
->e
== 99 && ss
->f
== 1.5 && ss
->g
== 42 && ss
->h
== (guint64
)123))
583 res
= g_new0 (simplestruct2
, 1);
584 memcpy (res
, ss
, sizeof (simplestruct2
));
585 res
->d
= g_strdup ("TEST-RES");
597 /* Yes, this is correct, we are only trying to determine the value of the stack here */
603 reliable_delegate (int a
)
609 * Checks whether get_sp() works as expected. It doesn't work with gcc-2.95.3 on linux.
612 is_get_sp_reliable (void)
616 reliable_delegate(1);
618 reliable_delegate(1);
624 mono_test_marshal_delegate (SimpleDelegate delegate
)
628 /* Check that the delegate wrapper is stdcall */
633 if (is_get_sp_reliable())
634 g_assert (sp1
== sp2
);
639 STDCALL SimpleDelegate
640 mono_test_marshal_return_delegate (SimpleDelegate delegate
)
646 return_plus_one (int i
)
651 STDCALL SimpleDelegate
652 mono_test_marshal_return_delegate_2 ()
654 return return_plus_one
;
657 typedef simplestruct (STDCALL
*SimpleDelegate2
) (simplestruct ss
);
660 is_utf16_equals (gunichar2
*s1
, const char *s2
)
665 s
= g_utf16_to_utf8 (s1
, -1, NULL
, NULL
, NULL
);
666 res
= strcmp (s
, s2
);
673 mono_test_marshal_delegate2 (SimpleDelegate2 delegate
)
675 simplestruct ss
, res
;
681 ss
.d2
= g_utf8_to_utf16 ("TEST2", -1, NULL
, NULL
, NULL
);
684 if (! (res
.a
&& !res
.b
&& res
.c
&& !strcmp (res
.d
, "TEST-RES") && is_utf16_equals (res
.d2
, "TEST2-RES")))
690 typedef simplestruct
* (STDCALL
*SimpleDelegate4
) (simplestruct
*ss
);
693 mono_test_marshal_delegate4 (SimpleDelegate4 delegate
)
704 res
= delegate (&ss
);
708 /* Check return value */
709 if (! (!res
->a
&& res
->b
&& !res
->c
&& !strcmp (res
->d
, "TEST")))
712 /* Check NULL argument and NULL result */
713 res
= delegate (NULL
);
720 typedef int (STDCALL
*SimpleDelegate5
) (simplestruct
**ss
);
723 mono_test_marshal_delegate5 (SimpleDelegate5 delegate
)
736 res
= delegate (&ptr
);
740 if (!(ptr
->a
&& !ptr
->b
&& ptr
->c
&& !strcmp (ptr
->d
, "RES")))
747 mono_test_marshal_delegate6 (SimpleDelegate5 delegate
)
751 res
= delegate (NULL
);
756 typedef int (STDCALL
*SimpleDelegate7
) (simplestruct
**ss
);
759 mono_test_marshal_delegate7 (SimpleDelegate7 delegate
)
764 /* Check that the input pointer is ignored */
765 ptr
= (gpointer
)0x12345678;
767 res
= delegate (&ptr
);
771 if (!(ptr
->a
&& !ptr
->b
&& ptr
->c
&& !strcmp (ptr
->d
, "RES")))
777 typedef int (STDCALL
*InOutByvalClassDelegate
) (simplestruct
*ss
);
780 mono_test_marshal_inout_byval_class_delegate (InOutByvalClassDelegate delegate
)
788 ss
.d
= g_strdup_printf ("%s", "FOO");
790 res
= delegate (&ss
);
794 if (!(ss
.a
&& !ss
.b
&& ss
.c
&& !strcmp (ss
.d
, "RES")))
800 typedef int (STDCALL
*SimpleDelegate8
) (gunichar2
*s
);
803 mono_test_marshal_delegate8 (SimpleDelegate8 delegate
, gunichar2
*s
)
808 typedef int (STDCALL
*return_int_fnt
) (int i
);
809 typedef int (STDCALL
*SimpleDelegate9
) (return_int_fnt d
);
812 mono_test_marshal_delegate9 (SimpleDelegate9 delegate
, gpointer ftn
)
814 return delegate (ftn
);
824 mono_test_marshal_delegate10 (SimpleDelegate9 delegate
)
826 return delegate (return_self
);
829 typedef int (STDCALL
*PrimitiveByrefDelegate
) (int *i
);
832 mono_test_marshal_primitive_byref_delegate (PrimitiveByrefDelegate delegate
)
836 int res
= delegate (&i
);
846 typedef int (STDCALL
*return_int_delegate
) (int i
);
848 typedef return_int_delegate (STDCALL
*ReturnDelegateDelegate
) (void);
851 mono_test_marshal_return_delegate_delegate (ReturnDelegateDelegate d
)
857 mono_test_marshal_stringbuilder (char *s
, int n
)
859 const char m
[] = "This is my message. Isn't it nice?";
861 if (strcmp (s
, "ABCD") != 0)
869 mono_test_marshal_stringbuilder_default (char *s
, int n
)
871 const char m
[] = "This is my message. Isn't it nice?";
879 mono_test_marshal_stringbuilder_unicode (gunichar2
*s
, int n
)
881 const char m
[] = "This is my message. Isn't it nice?";
885 s2
= g_utf8_to_utf16 (m
, -1, NULL
, &len
, NULL
);
904 mono_test_marshal_empty_string_array (char **array
)
906 return (array
== NULL
) ? 0 : 1;
910 mono_test_marshal_string_array (char **array
)
912 if (strcmp (array
[0], "ABC"))
914 if (strcmp (array
[1], "DEF"))
917 if (array
[2] != NULL
)
924 mono_test_marshal_byref_string_array (char ***array
)
929 if (strcmp ((*array
) [0], "Alpha"))
931 if (strcmp ((*array
) [1], "Beta"))
933 if (strcmp ((*array
) [2], "Gamma"))
940 mono_test_marshal_stringbuilder_array (char **array
)
942 if (strcmp (array
[0], "ABC"))
944 if (strcmp (array
[1], "DEF"))
947 strcpy (array
[0], "DEF");
948 strcpy (array
[1], "ABC");
954 mono_test_marshal_unicode_string_array (gunichar2
**array
, char **array2
)
956 GError
*error
= NULL
;
959 s
= g_utf16_to_utf8 (array
[0], -1, NULL
, NULL
, &error
);
960 if (strcmp (s
, "ABC")) {
967 s
= g_utf16_to_utf8 (array
[1], -1, NULL
, NULL
, &error
);
968 if (strcmp (s
, "DEF")) {
975 if (strcmp (array2
[0], "ABC"))
978 if (strcmp (array2
[1], "DEF"))
984 /* this does not work on Redhat gcc 2.96 */
986 mono_test_empty_struct (int a
, EmptyStruct es
, int b
)
988 // printf ("mono_test_empty_struct %d %d\n", a, b);
990 // Intel icc on ia64 passes 'es' in 2 registers
991 #if defined(__ia64) && defined(__INTEL_COMPILER)
994 if (a
== 1 && b
== 2)
1004 STDCALL ByValStrStruct
*
1005 mono_test_byvalstr_gen (void)
1007 ByValStrStruct
*ret
;
1009 ret
= malloc(sizeof(ByValStrStruct
));
1010 memset(ret
, 'a', sizeof(ByValStrStruct
)-1);
1011 ret
->a
[sizeof(ByValStrStruct
)-1] = 0;
1017 mono_test_byvalstr_check (ByValStrStruct
* data
, char* correctString
)
1021 ret
= strcmp(data
->a
, correctString
);
1022 // printf ("T1: %s\n", data->a);
1023 // printf ("T2: %s\n", correctString);
1025 marshal_free (data
);
1032 } ByValStrStruct_Unicode
;
1035 mono_test_byvalstr_check_unicode (ByValStrStruct_Unicode
*ref
, int test
)
1037 if (ref
->flag
!= 0x1234abcd){
1038 printf ("overwritten data");
1042 if (test
== 1 || test
== 3){
1043 if (ref
->a
[0] != '1' ||
1044 ref
->a
[1] != '2' ||
1050 if (ref
->a
[0] != '1' ||
1059 NameManglingAnsi (char *data
)
1061 return data
[0] + data
[1] + data
[2];
1065 NameManglingAnsiA (char *data
)
1067 g_assert_not_reached ();
1071 NameManglingAnsiW (char *data
)
1073 g_assert_not_reached ();
1077 NameManglingAnsi2A (char *data
)
1079 return data
[0] + data
[1] + data
[2];
1083 NameManglingAnsi2W (char *data
)
1085 g_assert_not_reached ();
1089 NameManglingUnicode (char *data
)
1091 g_assert_not_reached ();
1095 NameManglingUnicodeW (gunichar2
*data
)
1097 return data
[0] + data
[1] + data
[2];
1101 NameManglingUnicode2 (gunichar2
*data
)
1103 return data
[0] + data
[1] + data
[2];
1107 NameManglingAutoW (char *data
)
1110 return (data
[0] + data
[1] + data
[2]) == 131 ? 0 : 1;
1112 g_assert_not_reached ();
1117 NameManglingAuto (char *data
)
1120 return (data
[0] + data
[1] + data
[2]) == 198 ? 0 : 1;
1122 g_assert_not_reached ();
1126 typedef int (STDCALL
*intcharFunc
)(const char*);
1129 callFunction (intcharFunc f
)
1140 class_marshal_test0 (SimpleObj
*obj1
)
1142 // printf ("class_marshal_test0 %s %d\n", obj1->str, obj1->i);
1144 if (strcmp(obj1
->str
, "T1"))
1153 class_marshal_test4 (SimpleObj
*obj1
)
1162 class_marshal_test1 (SimpleObj
**obj1
)
1164 SimpleObj
*res
= malloc (sizeof (SimpleObj
));
1166 res
->str
= g_strdup ("ABC");
1173 class_marshal_test2 (SimpleObj
**obj1
)
1175 // printf ("class_marshal_test2 %s %d\n", (*obj1)->str, (*obj1)->i);
1177 if (strcmp((*obj1
)->str
, "ABC"))
1179 if ((*obj1
)->i
!= 5)
1186 string_marshal_test0 (char *str
)
1188 if (strcmp (str
, "TEST0"))
1195 string_marshal_test1 (const char **str
)
1201 string_marshal_test2 (char **str
)
1203 // printf ("string_marshal_test2 %s\n", *str);
1205 if (strcmp (*str
, "TEST1"))
1212 string_marshal_test3 (char *str
)
1225 STDCALL BlittableClass
*
1226 TestBlittableClass (BlittableClass
*vl
)
1228 BlittableClass
*res
;
1230 // printf ("TestBlittableClass %d %d\n", vl->a, vl->b);
1236 res
= g_new0 (BlittableClass
, 1);
1237 memcpy (res
, vl
, sizeof (BlittableClass
));
1239 res
= g_new0 (BlittableClass
, 1);
1247 typedef struct OSVERSIONINFO_STRUCT
1251 } OSVERSIONINFO_STRUCT
;
1254 MyGetVersionEx (OSVERSIONINFO_STRUCT
*osvi
)
1257 // printf ("GOT %d %d\n", osvi->a, osvi->b);
1262 return osvi
->a
+ osvi
->b
;
1266 BugGetVersionEx (int a
, int b
, int c
, int d
, int e
, int f
, int g
, int h
, OSVERSIONINFO_STRUCT
*osvi
)
1269 // printf ("GOT %d %d\n", osvi->a, osvi->b);
1274 return osvi
->a
+ osvi
->b
;
1278 mono_test_marshal_point (point pt
)
1280 // printf("point %g %g\n", pt.x, pt.y);
1281 if (pt
.x
== 1.25 && pt
.y
== 3.5)
1293 mono_test_marshal_mixed_point (mixed_point pt
)
1295 // printf("mixed point %d %g\n", pt.x, pt.y);
1296 if (pt
.x
== 5 && pt
.y
== 6.75)
1303 mono_test_marshal_mixed_point_2 (mixed_point
*pt
)
1305 if (pt
->x
!= 5 || pt
->y
!= 6.75)
1315 marshal_test_ref_bool(int i
, char *b1
, short *b2
, int *b3
)
1318 if (*b1
!= 0 && *b1
!= 1)
1320 if (*b2
!= 0 && *b2
!= -1) /* variant_bool */
1322 if (*b3
!= 0 && *b3
!= 1)
1324 if (i
== ((*b1
<< 2) | (-*b2
<< 1) | *b3
))
1336 short b2
; /* variant_bool */
1341 marshal_test_bool_struct(struct BoolStruct
*s
)
1344 if (s
->b1
!= 0 && s
->b1
!= 1)
1346 if (s
->b2
!= 0 && s
->b2
!= -1)
1348 if (s
->b3
!= 0 && s
->b3
!= 1)
1350 if (s
->i
== ((s
->b1
<< 2) | (-s
->b2
<< 1) | s
->b3
))
1359 mono_test_last_error (int err
)
1369 mono_test_asany (void *ptr
, int what
)
1373 return (*(int*)ptr
== 5) ? 0 : 1;
1375 return strcmp (ptr
, "ABC") == 0 ? 0 : 1;
1377 simplestruct2 ss
= *(simplestruct2
*)ptr
;
1379 if (ss
.a
== 0 && ss
.b
== 1 && ss
.c
== 0 &&
1380 !strcmp (ss
.d
, "TEST") &&
1381 ss
.e
== 99 && ss
.f
== 1.5 && ss
.g
== 42 && ss
.h
== (guint64
)123)
1387 GError
*error
= NULL
;
1390 s
= g_utf16_to_utf8 (ptr
, -1, NULL
, NULL
, &error
);
1391 if (!strcmp (s
, "ABC")) {
1401 g_assert_not_reached ();
1416 mono_test_marshal_asany_in (void* ptr
)
1418 AsAnyStruct
* asAny
= ptr
;
1419 int res
= asAny
->i
+ asAny
->j
+ asAny
->k
;
1425 mono_test_marshal_asany_inout (void* ptr
)
1427 AsAnyStruct
* asAny
= ptr
;
1428 int res
= asAny
->i
+ asAny
->j
+ asAny
->k
;
1430 marshal_free (asAny
->s
);
1441 mono_test_marshal_asany_out (void* ptr
)
1443 AsAnyStruct
* asAny
= ptr
;
1444 int res
= asAny
->i
+ asAny
->j
+ asAny
->k
;
1455 * AMD64 marshalling tests.
1458 typedef struct amd64_struct1
{
1465 STDCALL amd64_struct1
1466 mono_test_marshal_amd64_pass_return_struct1 (amd64_struct1 s
)
1476 typedef struct amd64_struct2
{
1481 STDCALL amd64_struct2
1482 mono_test_marshal_amd64_pass_return_struct2 (amd64_struct2 s
)
1490 typedef struct amd64_struct3
{
1494 STDCALL amd64_struct3
1495 mono_test_marshal_amd64_pass_return_struct3 (amd64_struct3 s
)
1502 typedef struct amd64_struct4
{
1506 STDCALL amd64_struct4
1507 mono_test_marshal_amd64_pass_return_struct4 (amd64_struct4 s
)
1516 * IA64 marshalling tests.
1518 typedef struct test_struct5
{
1522 STDCALL test_struct5
1523 mono_test_marshal_ia64_pass_return_struct5 (double d1
, double d2
, test_struct5 s
, double d3
, double d4
)
1531 typedef struct test_struct6
{
1535 STDCALL test_struct6
1536 mono_test_marshal_ia64_pass_return_struct6 (double d1
, double d2
, test_struct6 s
, double d3
, double d4
)
1544 static guint32 custom_res
[2];
1547 mono_test_marshal_pass_return_custom (int i
, guint32
*ptr
, int j
)
1549 /* ptr will be freed by CleanupNative, so make a copy */
1550 custom_res
[0] = 0; /* not allocated by AllocHGlobal */
1551 custom_res
[1] = ptr
[1];
1557 mono_test_marshal_pass_out_custom (int i
, guint32
**ptr
, int j
)
1560 custom_res
[1] = i
+ j
+ 10;
1568 mono_test_marshal_pass_inout_custom (int i
, guint32
*ptr
, int j
)
1571 ptr
[1] = i
+ ptr
[1] + j
;
1577 mono_test_marshal_pass_out_byval_custom (int i
, guint32
*ptr
, int j
)
1579 return ptr
== NULL
? 0 : 1;
1583 mono_test_marshal_pass_byref_custom (int i
, guint32
**ptr
, int j
)
1591 mono_test_marshal_pass_return_custom2 (int i
, guint32
*ptr
, int j
)
1593 g_assert_not_reached ();
1599 mono_test_marshal_pass_return_custom_null (int i
, guint32
*ptr
, int j
)
1601 g_assert (ptr
== NULL
);
1606 typedef void *(STDCALL
*PassReturnPtrDelegate
) (void *ptr
);
1609 mono_test_marshal_pass_return_custom_in_delegate (PassReturnPtrDelegate del
)
1623 /* FIXME: Freed with FreeHGlobal */
1632 mono_test_marshal_pass_return_custom_null_in_delegate (PassReturnPtrDelegate del
)
1634 void *ptr
= del (NULL
);
1636 return (ptr
== NULL
) ? 15 : 0;
1639 typedef void (STDCALL
*CustomOutParamDelegate
) (void **pptr
);
1642 mono_test_marshal_custom_out_param_delegate (CustomOutParamDelegate del
)
1654 typedef int (STDCALL
*ReturnEnumDelegate
) (int e
);
1657 mono_test_marshal_return_enum_delegate (ReturnEnumDelegate func
)
1667 typedef BlittableStruct (STDCALL
*SimpleDelegate10
) (BlittableStruct ss
);
1670 mono_test_marshal_blittable_struct_delegate (SimpleDelegate10 delegate
)
1672 BlittableStruct ss
, res
;
1679 res
= delegate (ss
);
1680 if (! ((res
.a
== -1) && (res
.b
== -2) && (res
.c
== -3) && (res
.d
== -55)))
1687 mono_test_stdcall_name_mangling (int a
, int b
, int c
)
1693 * PASSING AND RETURNING SMALL STRUCTURES FROM DELEGATES TESTS
1700 typedef SmallStruct1 (STDCALL
*SmallStructDelegate1
) (SmallStruct1 ss
);
1703 mono_test_marshal_small_struct_delegate1 (SmallStructDelegate1 delegate
)
1705 SmallStruct1 ss
, res
;
1709 res
= delegate (ss
);
1710 if (! (res
.i
== -1))
1720 typedef SmallStruct2 (STDCALL
*SmallStructDelegate2
) (SmallStruct2 ss
);
1723 mono_test_marshal_small_struct_delegate2 (SmallStructDelegate2 delegate
)
1725 SmallStruct2 ss
, res
;
1730 res
= delegate (ss
);
1731 if (! ((res
.i
== -2) && (res
.j
== -3)))
1742 typedef SmallStruct3 (STDCALL
*SmallStructDelegate3
) (SmallStruct3 ss
);
1745 mono_test_marshal_small_struct_delegate3 (SmallStructDelegate3 delegate
)
1747 SmallStruct3 ss
, res
;
1752 res
= delegate (ss
);
1753 if (! ((res
.i
== -1) && (res
.j
== -2)))
1763 typedef SmallStruct4 (STDCALL
*SmallStructDelegate4
) (SmallStruct4 ss
);
1766 mono_test_marshal_small_struct_delegate4 (SmallStructDelegate4 delegate
)
1768 SmallStruct4 ss
, res
;
1772 res
= delegate (ss
);
1773 if (! (res
.i
== -1))
1783 typedef SmallStruct5 (STDCALL
*SmallStructDelegate5
) (SmallStruct5 ss
);
1786 mono_test_marshal_small_struct_delegate5 (SmallStructDelegate5 delegate
)
1788 SmallStruct5 ss
, res
;
1792 res
= delegate (ss
);
1793 if (! (res
.i
== -5))
1803 typedef SmallStruct6 (STDCALL
*SmallStructDelegate6
) (SmallStruct6 ss
);
1806 mono_test_marshal_small_struct_delegate6 (SmallStructDelegate6 delegate
)
1808 SmallStruct6 ss
, res
;
1813 res
= delegate (ss
);
1814 if (! ((res
.i
== -1) && (res
.j
== -2)))
1825 typedef SmallStruct7 (STDCALL
*SmallStructDelegate7
) (SmallStruct7 ss
);
1828 mono_test_marshal_small_struct_delegate7 (SmallStructDelegate7 delegate
)
1830 SmallStruct7 ss
, res
;
1835 res
= delegate (ss
);
1836 if (! ((res
.i
== -1) && (res
.j
== -2)))
1846 typedef SmallStruct8 (STDCALL
*SmallStructDelegate8
) (SmallStruct8 ss
);
1849 mono_test_marshal_small_struct_delegate8 (SmallStructDelegate8 delegate
)
1851 SmallStruct8 ss
, res
;
1855 res
= delegate (ss
);
1856 if (! ((res
.i
== -1.0)))
1866 typedef SmallStruct9 (STDCALL
*SmallStructDelegate9
) (SmallStruct9 ss
);
1869 mono_test_marshal_small_struct_delegate9 (SmallStructDelegate9 delegate
)
1871 SmallStruct9 ss
, res
;
1875 res
= delegate (ss
);
1876 if (! ((res
.i
== -1.0)))
1886 typedef SmallStruct10 (STDCALL
*SmallStructDelegate10
) (SmallStruct10 ss
);
1889 mono_test_marshal_small_struct_delegate10 (SmallStructDelegate10 delegate
)
1891 SmallStruct10 ss
, res
;
1896 res
= delegate (ss
);
1897 if (! ((res
.i
== -1.0) && (res
.j
== -2.0)))
1908 typedef SmallStruct11 (STDCALL
*SmallStructDelegate11
) (SmallStruct11 ss
);
1911 mono_test_marshal_small_struct_delegate11 (SmallStructDelegate11 delegate
)
1913 SmallStruct11 ss
, res
;
1918 res
= delegate (ss
);
1919 if (! ((res
.i
== -1.0) && (res
.j
== -2)))
1925 typedef int (STDCALL
*ArrayDelegate
) (int i
, char *j
, void *arr
);
1928 mono_test_marshal_array_delegate (void *arr
, int len
, ArrayDelegate del
)
1930 return del (len
, NULL
, arr
);
1934 mono_test_marshal_out_array_delegate (int *arr
, int len
, ArrayDelegate del
)
1936 del (len
, NULL
, arr
);
1938 if ((arr
[0] != 1) || (arr
[1] != 2))
1944 typedef gunichar2
* (STDCALL
*UnicodeStringDelegate
) (gunichar2
*message
);
1947 mono_test_marshal_return_unicode_string_delegate (UnicodeStringDelegate del
)
1949 const char m
[] = "abcdef";
1950 gunichar2
*s2
, *res
;
1953 s2
= g_utf8_to_utf16 (m
, -1, NULL
, &len
, NULL
);
1963 mono_test_marshal_out_string_array_delegate (char **arr
, int len
, ArrayDelegate del
)
1965 del (len
, NULL
, arr
);
1967 if (!strcmp (arr
[0], "ABC") && !strcmp (arr
[1], "DEF"))
1973 typedef int (*CdeclDelegate
) (int i
, int j
);
1976 mono_test_marshal_cdecl_delegate (CdeclDelegate del
)
1980 for (i
= 0; i
< 1000; ++i
)
1986 typedef char** (*ReturnStringArrayDelegate
) (int i
);
1989 mono_test_marshal_return_string_array_delegate (ReturnStringArrayDelegate d
)
1997 if (strcmp (arr
[0], "ABC") || strcmp (arr
[1], "DEF"))
2008 add_delegate (int i
, int j
)
2014 mono_test_marshal_return_fnptr (void)
2016 return &add_delegate
;
2022 printf ("codigo %x\n", code
);
2031 mono_xr_as_handle (int code
)
2046 mono_safe_handle_struct_ref (HandleStructs
*x
)
2048 printf ("Dingus Ref! \n");
2049 printf ("Values: %d %d %d %d\n", x
->a
, x
->b
, x
->handle1
, x
->handle2
);
2055 if (x
->handle1
!= (void*) 0x7080feed)
2058 if (x
->handle2
!= (void*) 0x1234abcd)
2065 mono_safe_handle_struct (HandleStructs x
)
2067 printf ("Dingus Standard! \n");
2068 printf ("Values: %d %d %d %d\n", x
.a
, x
.b
, x
.handle1
, x
.handle2
);
2074 if (x
.handle1
!= (void*) 0x7080feed)
2077 if (x
.handle2
!= (void*) 0x1234abcd)
2088 mono_safe_handle_struct_simple (TrivialHandle x
)
2090 printf ("The value is %d\n", x
.a
);
2091 return ((int)x
.a
) * 2;
2095 mono_safe_handle_return ()
2101 mono_safe_handle_ref (void **handle
)
2104 *handle
= (void *) 0xbad;
2108 *handle
= (void *) 0x800d;
2117 mono_test_marshal_bstr_in(BSTR bstr
)
2119 if (!wcscmp(bstr
, L
"mono_test_marshal_bstr_in"))
2125 mono_test_marshal_bstr_out(BSTR
* bstr
)
2127 *bstr
= SysAllocString(L
"mono_test_marshal_bstr_out");
2132 mono_test_marshal_bstr_in_null(BSTR bstr
)
2140 mono_test_marshal_bstr_out_null(BSTR
* bstr
)
2147 mono_test_marshal_variant_in_sbyte(VARIANT variant
)
2149 if (variant
.vt
== VT_I1
&& variant
.cVal
== 100)
2155 mono_test_marshal_variant_in_byte(VARIANT variant
)
2157 if (variant
.vt
== VT_UI1
&& variant
.bVal
== 100)
2163 mono_test_marshal_variant_in_short(VARIANT variant
)
2165 if (variant
.vt
== VT_I2
&& variant
.iVal
== 314)
2171 mono_test_marshal_variant_in_ushort(VARIANT variant
)
2173 if (variant
.vt
== VT_UI2
&& variant
.uiVal
== 314)
2179 mono_test_marshal_variant_in_int(VARIANT variant
)
2181 if (variant
.vt
== VT_I4
&& variant
.lVal
== 314)
2187 mono_test_marshal_variant_in_uint(VARIANT variant
)
2189 if (variant
.vt
== VT_UI4
&& variant
.ulVal
== 314)
2195 mono_test_marshal_variant_in_long(VARIANT variant
)
2197 if (variant
.vt
== VT_I8
&& variant
.llVal
== 314)
2203 mono_test_marshal_variant_in_ulong(VARIANT variant
)
2205 if (variant
.vt
== VT_UI8
&& variant
.ullVal
== 314)
2211 mono_test_marshal_variant_in_float(VARIANT variant
)
2213 if (variant
.vt
== VT_R4
&& (variant
.fltVal
- 3.14)/3.14 < .001)
2219 mono_test_marshal_variant_in_double(VARIANT variant
)
2221 if (variant
.vt
== VT_R8
&& (variant
.dblVal
- 3.14)/3.14 < .001)
2227 mono_test_marshal_variant_in_bstr(VARIANT variant
)
2229 if (variant
.vt
== VT_BSTR
&& !wcscmp(variant
.bstrVal
, L
"PI"))
2235 mono_test_marshal_variant_in_bool_true (VARIANT variant
)
2237 if (variant
.vt
== VT_BOOL
&& variant
.boolVal
== VARIANT_TRUE
)
2243 mono_test_marshal_variant_in_bool_false (VARIANT variant
)
2245 if (variant
.vt
== VT_BOOL
&& variant
.boolVal
== VARIANT_FALSE
)
2251 mono_test_marshal_variant_out_sbyte(VARIANT
* variant
)
2253 variant
->vt
= VT_I1
;
2254 variant
->cVal
= 100;
2260 mono_test_marshal_variant_out_byte(VARIANT
* variant
)
2262 variant
->vt
= VT_UI1
;
2263 variant
->bVal
= 100;
2269 mono_test_marshal_variant_out_short(VARIANT
* variant
)
2271 variant
->vt
= VT_I2
;
2272 variant
->iVal
= 314;
2278 mono_test_marshal_variant_out_ushort(VARIANT
* variant
)
2280 variant
->vt
= VT_UI2
;
2281 variant
->uiVal
= 314;
2287 mono_test_marshal_variant_out_int(VARIANT
* variant
)
2289 variant
->vt
= VT_I4
;
2290 variant
->lVal
= 314;
2296 mono_test_marshal_variant_out_uint(VARIANT
* variant
)
2298 variant
->vt
= VT_UI4
;
2299 variant
->ulVal
= 314;
2305 mono_test_marshal_variant_out_long(VARIANT
* variant
)
2307 variant
->vt
= VT_I8
;
2308 variant
->llVal
= 314;
2314 mono_test_marshal_variant_out_ulong(VARIANT
* variant
)
2316 variant
->vt
= VT_UI8
;
2317 variant
->ullVal
= 314;
2323 mono_test_marshal_variant_out_float(VARIANT
* variant
)
2325 variant
->vt
= VT_R4
;
2326 variant
->fltVal
= 3.14;
2332 mono_test_marshal_variant_out_double(VARIANT
* variant
)
2334 variant
->vt
= VT_R8
;
2335 variant
->dblVal
= 3.14;
2341 mono_test_marshal_variant_out_bstr(VARIANT
* variant
)
2343 variant
->vt
= VT_BSTR
;
2344 variant
->bstrVal
= SysAllocString(L
"PI");
2350 mono_test_marshal_variant_out_bool_true (VARIANT
* variant
)
2352 variant
->vt
= VT_BOOL
;
2353 variant
->boolVal
= VARIANT_TRUE
;
2359 mono_test_marshal_variant_out_bool_false (VARIANT
* variant
)
2361 variant
->vt
= VT_BOOL
;
2362 variant
->boolVal
= VARIANT_FALSE
;
2367 typedef int (STDCALL
*VarFunc
) (int vt
, VARIANT variant
);
2368 typedef int (STDCALL
*VarRefFunc
) (int vt
, VARIANT
* variant
);
2371 mono_test_marshal_variant_in_sbyte_unmanaged(VarFunc func
)
2376 return func (VT_I1
, vt
);
2380 mono_test_marshal_variant_in_byte_unmanaged(VarFunc func
)
2385 return func (VT_UI1
, vt
);
2389 mono_test_marshal_variant_in_short_unmanaged(VarFunc func
)
2394 return func (VT_I2
, vt
);
2398 mono_test_marshal_variant_in_ushort_unmanaged(VarFunc func
)
2403 return func (VT_UI2
, vt
);
2407 mono_test_marshal_variant_in_int_unmanaged(VarFunc func
)
2412 return func (VT_I4
, vt
);
2416 mono_test_marshal_variant_in_uint_unmanaged(VarFunc func
)
2421 return func (VT_UI4
, vt
);
2425 mono_test_marshal_variant_in_long_unmanaged(VarFunc func
)
2430 return func (VT_I8
, vt
);
2434 mono_test_marshal_variant_in_ulong_unmanaged(VarFunc func
)
2439 return func (VT_UI8
, vt
);
2443 mono_test_marshal_variant_in_float_unmanaged(VarFunc func
)
2448 return func (VT_R4
, vt
);
2452 mono_test_marshal_variant_in_double_unmanaged(VarFunc func
)
2457 return func (VT_R8
, vt
);
2461 mono_test_marshal_variant_in_bstr_unmanaged(VarFunc func
)
2465 vt
.bstrVal
= SysAllocString(L
"PI");
2466 return func (VT_BSTR
, vt
);
2470 mono_test_marshal_variant_in_bool_true_unmanaged(VarFunc func
)
2474 vt
.boolVal
= VARIANT_TRUE
;
2475 return func (VT_BOOL
, vt
);
2479 mono_test_marshal_variant_in_bool_false_unmanaged(VarFunc func
)
2483 vt
.boolVal
= VARIANT_FALSE
;
2484 return func (VT_BOOL
, vt
);
2488 mono_test_marshal_variant_out_sbyte_unmanaged(VarRefFunc func
)
2493 if (vt
.vt
== VT_I1
&& vt
.cVal
== -100)
2499 mono_test_marshal_variant_out_byte_unmanaged(VarRefFunc func
)
2504 if (vt
.vt
== VT_UI1
&& vt
.bVal
== 100)
2510 mono_test_marshal_variant_out_short_unmanaged(VarRefFunc func
)
2515 if (vt
.vt
== VT_I2
&& vt
.iVal
== -100)
2521 mono_test_marshal_variant_out_ushort_unmanaged(VarRefFunc func
)
2526 if (vt
.vt
== VT_UI2
&& vt
.uiVal
== 100)
2532 mono_test_marshal_variant_out_int_unmanaged(VarRefFunc func
)
2537 if (vt
.vt
== VT_I4
&& vt
.lVal
== -100)
2543 mono_test_marshal_variant_out_uint_unmanaged(VarRefFunc func
)
2548 if (vt
.vt
== VT_UI4
&& vt
.ulVal
== 100)
2554 mono_test_marshal_variant_out_long_unmanaged(VarRefFunc func
)
2559 if (vt
.vt
== VT_I8
&& vt
.llVal
== -100)
2565 mono_test_marshal_variant_out_ulong_unmanaged(VarRefFunc func
)
2570 if (vt
.vt
== VT_UI8
&& vt
.ullVal
== 100)
2576 mono_test_marshal_variant_out_float_unmanaged(VarRefFunc func
)
2581 if (vt
.vt
== VT_R4
&& fabs (vt
.fltVal
- 3.14f
) < 1e-10)
2587 mono_test_marshal_variant_out_double_unmanaged(VarRefFunc func
)
2592 if (vt
.vt
== VT_R8
&& fabs (vt
.dblVal
- 3.14) < 1e-10)
2598 mono_test_marshal_variant_out_bstr_unmanaged(VarRefFunc func
)
2602 func (VT_BSTR
, &vt
);
2603 if (vt
.vt
== VT_BSTR
&& !wcscmp(vt
.bstrVal
, L
"PI"))
2609 mono_test_marshal_variant_out_bool_true_unmanaged(VarRefFunc func
)
2613 func (VT_BOOL
, &vt
);
2614 if (vt
.vt
== VT_BOOL
&& vt
.boolVal
== VARIANT_TRUE
)
2620 mono_test_marshal_variant_out_bool_false_unmanaged(VarRefFunc func
)
2624 func (VT_BOOL
, &vt
);
2625 if (vt
.vt
== VT_BOOL
&& vt
.boolVal
== VARIANT_TRUE
)
2630 typedef struct MonoComObject MonoComObject
;
2634 int (STDCALL
*QueryInterface
)(MonoComObject
* pUnk
, gpointer riid
, gpointer
* ppv
);
2635 int (STDCALL
*AddRef
)(MonoComObject
* pUnk
);
2636 int (STDCALL
*Release
)(MonoComObject
* pUnk
);
2637 int (STDCALL
*get_ITest
)(MonoComObject
* pUnk
, MonoComObject
* *ppUnk
);
2638 int (STDCALL
*SByteIn
)(MonoComObject
* pUnk
, char a
);
2639 int (STDCALL
*ByteIn
)(MonoComObject
* pUnk
, unsigned char a
);
2640 int (STDCALL
*ShortIn
)(MonoComObject
* pUnk
, short a
);
2641 int (STDCALL
*UShortIn
)(MonoComObject
* pUnk
, unsigned short a
);
2642 int (STDCALL
*IntIn
)(MonoComObject
* pUnk
, int a
);
2643 int (STDCALL
*UIntIn
)(MonoComObject
* pUnk
, unsigned int a
);
2644 int (STDCALL
*LongIn
)(MonoComObject
* pUnk
, LONGLONG a
);
2645 int (STDCALL
*ULongIn
)(MonoComObject
* pUnk
, ULONGLONG a
);
2646 int (STDCALL
*FloatIn
)(MonoComObject
* pUnk
, float a
);
2647 int (STDCALL
*DoubleIn
)(MonoComObject
* pUnk
, double a
);
2648 int (STDCALL
*ITestIn
)(MonoComObject
* pUnk
, MonoComObject
* pUnk2
);
2649 int (STDCALL
*ITestOut
)(MonoComObject
* pUnk
, MonoComObject
* *ppUnk
);
2652 struct MonoComObject
2658 DEFINE_GUID(IID_ITest
, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1);
2659 DEFINE_GUID(IID_IMonoUnknown
, 0, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46);
2660 DEFINE_GUID(IID_IMonoDispatch
, 0x00020400, 0, 0, 0xC0, 0, 0, 0, 0, 0, 0, 0x46);
2662 int STDCALL
MonoQueryInterface(MonoComObject
* pUnk
, gpointer riid
, gpointer
* ppv
)
2665 if (!memcmp(riid
, &IID_IMonoUnknown
, sizeof(GUID
))) {
2669 else if (!memcmp(riid
, &IID_ITest
, sizeof(GUID
))) {
2673 else if (!memcmp(riid
, &IID_IMonoDispatch
, sizeof(GUID
))) {
2677 return E_NOINTERFACE
;
2680 int STDCALL
MonoAddRef(MonoComObject
* pUnk
)
2682 return ++(pUnk
->m_ref
);
2685 int STDCALL
MonoRelease(MonoComObject
* pUnk
)
2687 return --(pUnk
->m_ref
);
2690 int STDCALL
SByteIn(MonoComObject
* pUnk
, char a
)
2695 int STDCALL
ByteIn(MonoComObject
* pUnk
, unsigned char a
)
2700 int STDCALL
ShortIn(MonoComObject
* pUnk
, short a
)
2705 int STDCALL
UShortIn(MonoComObject
* pUnk
, unsigned short a
)
2710 int STDCALL
IntIn(MonoComObject
* pUnk
, int a
)
2715 int STDCALL
UIntIn(MonoComObject
* pUnk
, unsigned int a
)
2720 int STDCALL
LongIn(MonoComObject
* pUnk
, LONGLONG a
)
2725 int STDCALL
ULongIn(MonoComObject
* pUnk
, ULONGLONG a
)
2730 int STDCALL
FloatIn(MonoComObject
* pUnk
, float a
)
2735 int STDCALL
DoubleIn(MonoComObject
* pUnk
, double a
)
2740 int STDCALL
ITestIn(MonoComObject
* pUnk
, MonoComObject
*pUnk2
)
2745 int STDCALL
ITestOut(MonoComObject
* pUnk
, MonoComObject
* *ppUnk
)
2750 int STDCALL
get_ITest(MonoComObject
* pUnk
, MonoComObject
* *ppUnk
)
2755 static void create_com_object (MonoComObject
** pOut
)
2757 *pOut
= g_new0 (MonoComObject
, 1);
2758 (*pOut
)->vtbl
= g_new0 (MonoIUnknown
, 1);
2761 (*pOut
)->vtbl
->QueryInterface
= MonoQueryInterface
;
2762 (*pOut
)->vtbl
->AddRef
= MonoAddRef
;
2763 (*pOut
)->vtbl
->Release
= MonoRelease
;
2764 (*pOut
)->vtbl
->SByteIn
= SByteIn
;
2765 (*pOut
)->vtbl
->ByteIn
= ByteIn
;
2766 (*pOut
)->vtbl
->ShortIn
= ShortIn
;
2767 (*pOut
)->vtbl
->UShortIn
= UShortIn
;
2768 (*pOut
)->vtbl
->IntIn
= IntIn
;
2769 (*pOut
)->vtbl
->UIntIn
= UIntIn
;
2770 (*pOut
)->vtbl
->LongIn
= LongIn
;
2771 (*pOut
)->vtbl
->ULongIn
= ULongIn
;
2772 (*pOut
)->vtbl
->FloatIn
= FloatIn
;
2773 (*pOut
)->vtbl
->DoubleIn
= DoubleIn
;
2774 (*pOut
)->vtbl
->ITestIn
= ITestIn
;
2775 (*pOut
)->vtbl
->ITestOut
= ITestOut
;
2776 (*pOut
)->vtbl
->get_ITest
= get_ITest
;
2779 static MonoComObject
* same_object
= NULL
;
2782 mono_test_marshal_com_object_create(MonoComObject
* *pUnk
)
2784 create_com_object (pUnk
);
2787 same_object
= *pUnk
;
2793 mono_test_marshal_com_object_same(MonoComObject
* *pUnk
)
2795 *pUnk
= same_object
;
2801 mono_test_marshal_com_object_destroy(MonoComObject
*pUnk
)
2803 int ref
= --(pUnk
->m_ref
);
2811 mono_test_marshal_com_object_ref_count(MonoComObject
*pUnk
)
2817 mono_test_marshal_ccw_itest (MonoComObject
*pUnk
)
2820 MonoComObject
* pTest
;
2825 hr
= pUnk
->vtbl
->SByteIn (pUnk
, -100);
2828 hr
= pUnk
->vtbl
->ByteIn (pUnk
, 100);
2831 hr
= pUnk
->vtbl
->ShortIn (pUnk
, -100);
2834 hr
= pUnk
->vtbl
->UShortIn (pUnk
, 100);
2837 hr
= pUnk
->vtbl
->IntIn (pUnk
, -100);
2840 hr
= pUnk
->vtbl
->UIntIn (pUnk
, 100);
2843 hr
= pUnk
->vtbl
->LongIn (pUnk
, -100);
2846 hr
= pUnk
->vtbl
->ULongIn (pUnk
, 100);
2849 hr
= pUnk
->vtbl
->FloatIn (pUnk
, 3.14f
);
2852 hr
= pUnk
->vtbl
->DoubleIn (pUnk
, 3.14);
2855 hr
= pUnk
->vtbl
->ITestIn (pUnk
, pUnk
);
2858 hr
= pUnk
->vtbl
->ITestOut (pUnk
, &pTest
);