9 #define STDCALL __stdcall
15 extern __declspec(dllimport) __stdcall void CoTaskMemFree(void *ptr);
18 typedef int (STDCALL *SimpleDelegate) (int a);
20 static void marshal_free (void *ptr)
29 STDCALL unsigned short*
30 test_lpwstr_marshal (unsigned short* chars, long length)
35 res = malloc (2 * (length + 1));
37 // printf("test_lpwstr_marshal()\n");
39 while ( i < length ) {
40 // printf("X|%u|\n", chars[i]);
57 mono_union_test_1 (union_test_1_type u1) {
58 // printf ("Got values %d %d %d\n", u1.b, u1.a, u1.c);
59 return u1.a + u1.b + u1.c;
63 mono_return_int (int a) {
64 // printf ("Got value %d\n", a);
74 mono_return_int_ss (struct ss a) {
75 // printf ("Got value %d\n", a.i);
80 mono_return_ss (struct ss a) {
81 // printf ("Got value %d\n", a.i);
92 mono_return_sc1 (struct sc1 a) {
93 // printf ("Got value %d\n", a.c[0]);
105 mono_return_sc3 (struct sc3 a) {
106 // printf ("Got values %d %d %d\n", a.c[0], a.c[1], a.c[2]);
119 mono_return_sc5 (struct sc5 a) {
120 // printf ("Got values %d %d %d %d %d\n", a.c[0], a.c[1], a.c[2], a.c[3], a.c[4]);
136 mono_return_int_su (union su a) {
137 // printf ("Got value %d\n", a.i1);
142 mono_test_many_int_arguments (int a, int b, int c, int d, int e,
143 int f, int g, int h, int i, int j);
145 mono_test_many_short_arguments (short a, short b, short c, short d, short e,
146 short f, short g, short h, short i, short j);
148 mono_test_many_char_arguments (char a, char b, char c, char d, char e,
149 char f, char g, char h, char i, char j);
152 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)
154 return a + b + c + d + e + f + g + h + i + j;
158 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)
160 return a + b + c + d + e + f + g + h + i + j;
164 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)
166 return a + b + c + d + e + f + g + h + i + j;
170 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)
172 return a + b + c + d + e + f + g + h + i + j;
176 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)
178 return a + b + c + d + e + f + g + h + i + j;
182 mono_test_split_double_arguments (double a, double b, float c, double d, double e)
184 return a + b + c + d + e;
188 mono_test_puts_static (char *s)
190 // printf ("TEST %s\n", s);
194 typedef int (STDCALL *SimpleDelegate3) (int a, int b);
197 mono_invoke_delegate (SimpleDelegate3 delegate)
201 // printf ("start invoke %p\n", delegate);
203 res = delegate (2, 3);
205 // printf ("end invoke\n");
211 mono_test_marshal_char (short a1)
220 mono_test_marshal_char_array (gunichar2 *s)
222 const char m[] = "abcdef";
226 s2 = g_utf8_to_utf16 (m, -1, NULL, &len, NULL);
235 mono_test_empty_pinvoke (int i)
241 mono_test_marshal_bool_byref (int a, int *b, int c)
251 mono_test_marshal_array (int *a1)
255 for (i = 0; i < 50; i++)
262 mono_test_marshal_inout_array (int *a1)
266 for (i = 0; i < 50; i++) {
268 a1 [i] = 50 - a1 [i];
275 mono_test_marshal_out_array (int *a1)
279 for (i = 0; i < 50; i++) {
287 mono_test_marshal_inout_nonblittable_array (gunichar2 *a1)
291 for (i = 0; i < 10; i++) {
307 mono_test_return_vtype (int i)
310 static gunichar2 test2 [] = { 'T', 'E', 'S', 'T', '2', 0 };
322 mono_test_delegate_struct (void)
324 // printf ("TEST\n");
327 typedef char* (STDCALL *ReturnStringDelegate) (const char *s);
330 mono_test_return_string (ReturnStringDelegate func)
334 // printf ("mono_test_return_string\n");
339 // printf ("got string: %s\n", res);
340 return g_strdup ("12345");
343 typedef int (STDCALL *RefVTypeDelegate) (int a, simplestruct *ss, int b);
346 mono_test_ref_vtype (int a, simplestruct *ss, int b, RefVTypeDelegate func)
348 if (a == 1 && b == 2 && ss->a == 0 && ss->b == 1 && ss->c == 0 &&
349 !strcmp (ss->d, "TEST1")) {
355 return func (a, ss, b);
361 typedef int (STDCALL *OutVTypeDelegate) (int a, simplestruct *ss, int b);
364 mono_test_marshal_out_struct (int a, simplestruct *ss, int b, OutVTypeDelegate func)
366 /* Check that the input pointer is ignored */
367 ss->d = (gpointer)0x12345678;
371 if (ss->a && ss->b && ss->c && !strcmp (ss->d, "TEST3"))
379 SimpleDelegate func, func2;
382 STDCALL DelegateStruct
383 mono_test_marshal_delegate_struct (DelegateStruct ds)
387 res.a = ds.func (ds.a) + ds.func2 (ds.a);
389 res.func2 = ds.func2;
395 mono_test_marshal_struct (simplestruct ss)
397 if (ss.a == 0 && ss.b == 1 && ss.c == 0 &&
398 !strcmp (ss.d, "TEST"))
416 mono_test_marshal_struct2 (simplestruct2 ss)
418 if (ss.a == 0 && ss.b == 1 && ss.c == 0 &&
419 !strcmp (ss.d, "TEST") &&
420 ss.e == 99 && ss.f == 1.5 && ss.g == 42 && ss.h == (guint64)123)
426 /* on HP some of the struct should be on the stack and not in registers */
428 mono_test_marshal_struct2_2 (int i, int j, int k, simplestruct2 ss)
430 if (i != 10 || j != 11 || k != 12)
432 if (ss.a == 0 && ss.b == 1 && ss.c == 0 &&
433 !strcmp (ss.d, "TEST") &&
434 ss.e == 99 && ss.f == 1.5 && ss.g == 42 && ss.h == (guint64)123)
441 mono_test_marshal_struct_array (simplestruct2 *ss)
443 if (! (ss[0].a == 0 && ss[0].b == 1 && ss[0].c == 0 &&
444 !strcmp (ss[0].d, "TEST") &&
445 ss[0].e == 99 && ss[0].f == 1.5 && ss[0].g == 42 && ss[0].h == (guint64)123))
448 if (! (ss[1].a == 0 && ss[1].b == 0 && ss[1].c == 0 &&
449 !strcmp (ss[1].d, "TEST2") &&
450 ss[1].e == 100 && ss[1].f == 2.5 && ss[1].g == 43 && ss[1].h == (guint64)124))
456 typedef struct long_align_struct {
463 mono_test_marshal_long_align_struct_array (long_align_struct *ss)
465 return ss[0].a + ss[0].b + ss[0].c + ss[1].a + ss[1].b + ss[1].c;
468 STDCALL simplestruct2 *
469 mono_test_marshal_class (int i, int j, int k, simplestruct2 *ss, int l)
476 if (i != 10 || j != 11 || k != 12 || l != 14)
478 if (! (ss->a == 0 && ss->b == 1 && ss->c == 0 &&
479 !strcmp (ss->d, "TEST") &&
480 ss->e == 99 && ss->f == 1.5 && ss->g == 42 && ss->h == (guint64)123))
483 res = g_new0 (simplestruct2, 1);
484 memcpy (res, ss, sizeof (simplestruct2));
485 res->d = g_strdup ("TEST");
490 mono_test_marshal_byref_class (simplestruct2 **ssp)
492 simplestruct2 *ss = *ssp;
495 if (! (ss->a == 0 && ss->b == 1 && ss->c == 0 &&
496 !strcmp (ss->d, "TEST") &&
497 ss->e == 99 && ss->f == 1.5 && ss->g == 42 && ss->h == (guint64)123))
500 res = g_new0 (simplestruct2, 1);
501 memcpy (res, ss, sizeof (simplestruct2));
502 res->d = g_strdup ("TEST-RES");
519 reliable_delegate (int a)
525 * Checks whether get_sp() works as expected. It doesn't work with gcc-2.95.3 on linux.
528 is_get_sp_reliable (void)
532 reliable_delegate(1);
534 reliable_delegate(1);
540 mono_test_marshal_delegate (SimpleDelegate delegate)
544 /* Check that the delegate wrapper is stdcall */
549 if (is_get_sp_reliable())
550 g_assert (sp1 == sp2);
555 STDCALL SimpleDelegate
556 mono_test_marshal_return_delegate (SimpleDelegate delegate)
562 return_plus_one (int i)
567 STDCALL SimpleDelegate
568 mono_test_marshal_return_delegate_2 ()
570 return return_plus_one;
573 typedef simplestruct (STDCALL *SimpleDelegate2) (simplestruct ss);
576 is_utf16_equals (gunichar2 *s1, const char *s2)
581 s = g_utf16_to_utf8 (s1, -1, NULL, NULL, NULL);
582 res = strcmp (s, s2);
589 mono_test_marshal_delegate2 (SimpleDelegate2 delegate)
591 simplestruct ss, res;
597 ss.d2 = g_utf8_to_utf16 ("TEST2", -1, NULL, NULL, NULL);
600 if (! (res.a && !res.b && res.c && !strcmp (res.d, "TEST-RES") && is_utf16_equals (res.d2, "TEST2-RES")))
606 typedef simplestruct* (STDCALL *SimpleDelegate4) (simplestruct *ss);
609 mono_test_marshal_delegate4 (SimpleDelegate4 delegate)
620 res = delegate (&ss);
624 /* Check return value */
625 if (! (!res->a && res->b && !res->c && !strcmp (res->d, "TEST")))
628 /* Check NULL argument and NULL result */
629 res = delegate (NULL);
636 typedef int (STDCALL *SimpleDelegate5) (simplestruct **ss);
639 mono_test_marshal_delegate5 (SimpleDelegate5 delegate)
652 res = delegate (&ptr);
656 if (!(ptr->a && !ptr->b && ptr->c && !strcmp (ptr->d, "RES")))
663 mono_test_marshal_delegate6 (SimpleDelegate5 delegate)
667 res = delegate (NULL);
672 typedef int (STDCALL *SimpleDelegate7) (simplestruct **ss);
675 mono_test_marshal_delegate7 (SimpleDelegate7 delegate)
680 /* Check that the input pointer is ignored */
681 ptr = (gpointer)0x12345678;
683 res = delegate (&ptr);
687 if (!(ptr->a && !ptr->b && ptr->c && !strcmp (ptr->d, "RES")))
693 typedef int (STDCALL *SimpleDelegate8) (gunichar2 *s);
696 mono_test_marshal_delegate8 (SimpleDelegate8 delegate, gunichar2 *s)
701 typedef int (STDCALL *return_int_fnt) (int i);
702 typedef int (STDCALL *SimpleDelegate9) (return_int_fnt d);
705 mono_test_marshal_delegate9 (SimpleDelegate9 delegate, gpointer ftn)
707 return delegate (ftn);
717 mono_test_marshal_delegate10 (SimpleDelegate9 delegate)
719 return delegate (return_self);
722 typedef int (STDCALL *PrimitiveByrefDelegate) (int *i);
725 mono_test_marshal_primitive_byref_delegate (PrimitiveByrefDelegate delegate)
729 int res = delegate (&i);
739 typedef int (STDCALL *return_int_delegate) (int i);
741 typedef return_int_delegate (STDCALL *ReturnDelegateDelegate) (void);
744 mono_test_marshal_return_delegate_delegate (ReturnDelegateDelegate d)
750 mono_test_marshal_stringbuilder (char *s, int n)
752 const char m[] = "This is my message. Isn't it nice?";
754 if (strcmp (s, "ABCD") != 0)
761 mono_test_marshal_stringbuilder_unicode (gunichar2 *s, int n)
763 const char m[] = "This is my message. Isn't it nice?";
767 s2 = g_utf8_to_utf16 (m, -1, NULL, &len, NULL);
786 mono_test_marshal_empty_string_array (char **array)
788 return (array == NULL) ? 0 : 1;
792 mono_test_marshal_string_array (char **array)
794 if (strcmp (array [0], "ABC"))
796 if (strcmp (array [1], "DEF"))
799 if (array [2] != NULL)
806 mono_test_marshal_byref_string_array (char ***array)
811 if (strcmp ((*array) [0], "Alpha"))
813 if (strcmp ((*array) [1], "Beta"))
815 if (strcmp ((*array) [2], "Gamma"))
822 mono_test_marshal_stringbuilder_array (char **array)
824 if (strcmp (array [0], "ABC"))
826 if (strcmp (array [1], "DEF"))
829 strcpy (array [0], "DEF");
830 strcpy (array [1], "ABC");
836 mono_test_marshal_unicode_string_array (gunichar2 **array, char **array2)
838 GError *error = NULL;
841 s = g_utf16_to_utf8 (array [0], -1, NULL, NULL, &error);
842 if (strcmp (s, "ABC")) {
849 s = g_utf16_to_utf8 (array [1], -1, NULL, NULL, &error);
850 if (strcmp (s, "DEF")) {
857 if (strcmp (array2 [0], "ABC"))
860 if (strcmp (array2 [1], "DEF"))
866 /* this does not work on Redhat gcc 2.96 */
868 mono_test_empty_struct (int a, EmptyStruct es, int b)
870 // printf ("mono_test_empty_struct %d %d\n", a, b);
872 // Intel icc on ia64 passes 'es' in 2 registers
873 #if defined(__ia64) && defined(__INTEL_COMPILER)
876 if (a == 1 && b == 2)
886 STDCALL ByValStrStruct *
887 mono_test_byvalstr_gen (void)
891 ret = malloc(sizeof(ByValStrStruct));
892 memset(ret, 'a', sizeof(ByValStrStruct)-1);
893 ret->a[sizeof(ByValStrStruct)-1] = 0;
899 mono_test_byvalstr_check (ByValStrStruct* data, char* correctString)
903 ret = strcmp(data->a, correctString);
904 // printf ("T1: %s\n", data->a);
905 // printf ("T2: %s\n", correctString);
912 NameManglingAnsi (char *data)
914 return data [0] + data [1] + data [2];
918 NameManglingAnsiA (char *data)
920 g_assert_not_reached ();
924 NameManglingAnsiW (char *data)
926 g_assert_not_reached ();
930 NameManglingAnsi2A (char *data)
932 return data [0] + data [1] + data [2];
936 NameManglingAnsi2W (char *data)
938 g_assert_not_reached ();
942 NameManglingUnicode (char *data)
944 g_assert_not_reached ();
948 NameManglingUnicodeW (gunichar2 *data)
950 return data [0] + data [1] + data [2];
954 NameManglingUnicode2 (gunichar2 *data)
956 return data [0] + data [1] + data [2];
960 NameManglingAutoW (char *data)
963 return (data [0] + data [1] + data [2]) == 131 ? 0 : 1;
965 g_assert_not_reached ();
970 NameManglingAuto (char *data)
973 return (data [0] + data [1] + data [2]) == 198 ? 0 : 1;
975 g_assert_not_reached ();
979 typedef int (STDCALL *intcharFunc)(const char*);
982 callFunction (intcharFunc f)
993 class_marshal_test0 (SimpleObj *obj1)
995 // printf ("class_marshal_test0 %s %d\n", obj1->str, obj1->i);
997 if (strcmp(obj1->str, "T1"))
1006 class_marshal_test4 (SimpleObj *obj1)
1015 class_marshal_test1 (SimpleObj **obj1)
1017 SimpleObj *res = malloc (sizeof (SimpleObj));
1019 res->str = g_strdup ("ABC");
1026 class_marshal_test2 (SimpleObj **obj1)
1028 // printf ("class_marshal_test2 %s %d\n", (*obj1)->str, (*obj1)->i);
1030 if (strcmp((*obj1)->str, "ABC"))
1032 if ((*obj1)->i != 5)
1039 string_marshal_test0 (char *str)
1041 if (strcmp (str, "TEST0"))
1048 string_marshal_test1 (const char **str)
1054 string_marshal_test2 (char **str)
1056 // printf ("string_marshal_test2 %s\n", *str);
1058 if (strcmp (*str, "TEST1"))
1065 string_marshal_test3 (char *str)
1079 TestVectorList (VectorList *vl)
1083 // printf ("TestVectorList %d %d\n", vl->a, vl->b);
1088 res = g_new0 (VectorList, 1);
1089 memcpy (res, vl, sizeof (VectorList));
1094 typedef struct _OSVERSIONINFO
1101 GetVersionEx (OSVERSIONINFO *osvi)
1104 // printf ("GOT %d %d\n", osvi->a, osvi->b);
1109 return osvi->a + osvi->b;
1113 BugGetVersionEx (int a, int b, int c, int d, int e, int f, int g, int h, OSVERSIONINFO *osvi)
1116 // printf ("GOT %d %d\n", osvi->a, osvi->b);
1121 return osvi->a + osvi->b;
1130 mono_test_marshal_point (point pt)
1132 // printf("point %g %g\n", pt.x, pt.y);
1133 if (pt.x == 1.25 && pt.y == 3.5)
1145 mono_test_marshal_mixed_point (mixed_point pt)
1147 // printf("mixed point %d %g\n", pt.x, pt.y);
1148 if (pt.x == 5 && pt.y == 6.75)
1155 mono_test_marshal_mixed_point_2 (mixed_point *pt)
1157 if (pt->x != 5 || pt->y != 6.75)
1167 marshal_test_ref_bool(int i, char *b1, short *b2, int *b3)
1170 if (*b1 != 0 && *b1 != 1)
1172 if (*b2 != 0 && *b2 != -1) /* variant_bool */
1174 if (*b3 != 0 && *b3 != 1)
1176 if (i == ((*b1 << 2) | (-*b2 << 1) | *b3))
1188 short b2; /* variant_bool */
1193 marshal_test_bool_struct(struct BoolStruct *s)
1196 if (s->b1 != 0 && s->b1 != 1)
1198 if (s->b2 != 0 && s->b2 != -1)
1200 if (s->b3 != 0 && s->b3 != 1)
1202 if (s->i == ((s->b1 << 2) | (-s->b2 << 1) | s->b3))
1211 extern __declspec(dllimport) __stdcall void SetLastError(int x);
1215 mono_test_last_error (int err)
1225 mono_test_asany (void *ptr, int what)
1229 return (*(int*)ptr == 5) ? 0 : 1;
1231 return strcmp (ptr, "ABC") == 0 ? 0 : 1;
1233 simplestruct2 ss = *(simplestruct2*)ptr;
1235 if (ss.a == 0 && ss.b == 1 && ss.c == 0 &&
1236 !strcmp (ss.d, "TEST") &&
1237 ss.e == 99 && ss.f == 1.5 && ss.g == 42 && ss.h == (guint64)123)
1243 GError *error = NULL;
1246 s = g_utf16_to_utf8 (ptr, -1, NULL, NULL, &error);
1247 if (!strcmp (s, "ABC")) {
1257 g_assert_not_reached ();
1264 * AMD64 marshalling tests.
1267 typedef struct amd64_struct1 {
1274 STDCALL amd64_struct1
1275 mono_test_marshal_amd64_pass_return_struct1 (amd64_struct1 s)
1285 typedef struct amd64_struct2 {
1290 STDCALL amd64_struct2
1291 mono_test_marshal_amd64_pass_return_struct2 (amd64_struct2 s)
1299 typedef struct amd64_struct3 {
1303 STDCALL amd64_struct3
1304 mono_test_marshal_amd64_pass_return_struct3 (amd64_struct3 s)
1311 typedef struct amd64_struct4 {
1315 STDCALL amd64_struct4
1316 mono_test_marshal_amd64_pass_return_struct4 (amd64_struct4 s)
1325 * IA64 marshalling tests.
1327 typedef struct test_struct5 {
1331 STDCALL test_struct5
1332 mono_test_marshal_ia64_pass_return_struct5 (double d1, double d2, test_struct5 s, double d3, double d4)
1340 typedef struct test_struct6 {
1344 STDCALL test_struct6
1345 mono_test_marshal_ia64_pass_return_struct6 (double d1, double d2, test_struct6 s, double d3, double d4)
1353 static guint32 custom_res [2];
1356 mono_test_marshal_pass_return_custom (int i, guint32 *ptr, int j)
1358 /* ptr will be freed by CleanupNative, so make a copy */
1359 custom_res [0] = 0; /* not allocated by AllocHGlobal */
1360 custom_res [1] = ptr [1];
1366 mono_test_marshal_pass_out_custom (int i, guint32 **ptr, int j)
1369 custom_res [1] = i + j + 10;
1377 mono_test_marshal_pass_byref_custom (int i, guint32 **ptr, int j)
1385 mono_test_marshal_pass_return_custom2 (int i, guint32 *ptr, int j)
1387 g_assert_not_reached ();
1393 mono_test_marshal_pass_return_custom_null (int i, guint32 *ptr, int j)
1395 g_assert (ptr == NULL);
1400 typedef void *(STDCALL *PassReturnPtrDelegate) (void *ptr);
1403 mono_test_marshal_pass_return_custom_in_delegate (PassReturnPtrDelegate del)
1417 /* FIXME: Freed with FreeHGlobal */
1426 mono_test_marshal_pass_return_custom_null_in_delegate (PassReturnPtrDelegate del)
1428 void *ptr = del (NULL);
1430 return (ptr == NULL) ? 15 : 0;
1433 typedef int (STDCALL *ReturnEnumDelegate) (int e);
1436 mono_test_marshal_return_enum_delegate (ReturnEnumDelegate func)
1446 typedef BlittableStruct (STDCALL *SimpleDelegate10) (BlittableStruct ss);
1449 mono_test_marshal_blittable_struct_delegate (SimpleDelegate10 delegate)
1451 BlittableStruct ss, res;
1458 res = delegate (ss);
1459 if (! ((res.a == -1) && (res.b == -2) && (res.c == -3) && (res.d == -55)))
1466 mono_test_stdcall_name_mangling (int a, int b, int c)
1472 * PASSING AND RETURNING SMALL STRUCTURES FROM DELEGATES TESTS
1479 typedef SmallStruct1 (STDCALL *SmallStructDelegate1) (SmallStruct1 ss);
1482 mono_test_marshal_small_struct_delegate1 (SmallStructDelegate1 delegate)
1484 SmallStruct1 ss, res;
1488 res = delegate (ss);
1489 if (! (res.i == -1))
1499 typedef SmallStruct2 (STDCALL *SmallStructDelegate2) (SmallStruct2 ss);
1502 mono_test_marshal_small_struct_delegate2 (SmallStructDelegate2 delegate)
1504 SmallStruct2 ss, res;
1509 res = delegate (ss);
1510 if (! ((res.i == -2) && (res.j == -3)))
1521 typedef SmallStruct3 (STDCALL *SmallStructDelegate3) (SmallStruct3 ss);
1524 mono_test_marshal_small_struct_delegate3 (SmallStructDelegate3 delegate)
1526 SmallStruct3 ss, res;
1531 res = delegate (ss);
1532 if (! ((res.i == -1) && (res.j == -2)))
1542 typedef SmallStruct4 (STDCALL *SmallStructDelegate4) (SmallStruct4 ss);
1545 mono_test_marshal_small_struct_delegate4 (SmallStructDelegate4 delegate)
1547 SmallStruct4 ss, res;
1551 res = delegate (ss);
1552 if (! (res.i == -1))
1562 typedef SmallStruct5 (STDCALL *SmallStructDelegate5) (SmallStruct5 ss);
1565 mono_test_marshal_small_struct_delegate5 (SmallStructDelegate5 delegate)
1567 SmallStruct5 ss, res;
1571 res = delegate (ss);
1572 if (! (res.i == -5))
1582 typedef SmallStruct6 (STDCALL *SmallStructDelegate6) (SmallStruct6 ss);
1585 mono_test_marshal_small_struct_delegate6 (SmallStructDelegate6 delegate)
1587 SmallStruct6 ss, res;
1592 res = delegate (ss);
1593 if (! ((res.i == -1) && (res.j == -2)))
1604 typedef SmallStruct7 (STDCALL *SmallStructDelegate7) (SmallStruct7 ss);
1607 mono_test_marshal_small_struct_delegate7 (SmallStructDelegate7 delegate)
1609 SmallStruct7 ss, res;
1614 res = delegate (ss);
1615 if (! ((res.i == -1) && (res.j == -2)))
1625 typedef SmallStruct8 (STDCALL *SmallStructDelegate8) (SmallStruct8 ss);
1628 mono_test_marshal_small_struct_delegate8 (SmallStructDelegate8 delegate)
1630 SmallStruct8 ss, res;
1634 res = delegate (ss);
1635 if (! ((res.i == -1.0)))
1645 typedef SmallStruct9 (STDCALL *SmallStructDelegate9) (SmallStruct9 ss);
1648 mono_test_marshal_small_struct_delegate9 (SmallStructDelegate9 delegate)
1650 SmallStruct9 ss, res;
1654 res = delegate (ss);
1655 if (! ((res.i == -1.0)))
1665 typedef SmallStruct10 (STDCALL *SmallStructDelegate10) (SmallStruct10 ss);
1668 mono_test_marshal_small_struct_delegate10 (SmallStructDelegate10 delegate)
1670 SmallStruct10 ss, res;
1675 res = delegate (ss);
1676 if (! ((res.i == -1.0) && (res.j == -2.0)))
1687 typedef SmallStruct11 (STDCALL *SmallStructDelegate11) (SmallStruct11 ss);
1690 mono_test_marshal_small_struct_delegate11 (SmallStructDelegate11 delegate)
1692 SmallStruct11 ss, res;
1697 res = delegate (ss);
1698 if (! ((res.i == -1.0) && (res.j == -2)))
1704 typedef int (STDCALL *ArrayDelegate) (int i, char *j, void *arr);
1707 mono_test_marshal_array_delegate (void *arr, int len, ArrayDelegate del)
1709 return del (len, NULL, arr);
1713 mono_test_marshal_out_array_delegate (int *arr, int len, ArrayDelegate del)
1715 del (len, NULL, arr);
1717 if ((arr [0] != 1) || (arr [1] != 2))
1724 mono_test_marshal_out_string_array_delegate (char **arr, int len, ArrayDelegate del)
1726 del (len, NULL, arr);
1728 if (!strcmp (arr [0], "ABC") && !strcmp (arr [1], "DEF"))
1734 typedef int (*CdeclDelegate) (int i, int j);
1737 mono_test_marshal_cdecl_delegate (CdeclDelegate del)
1741 for (i = 0; i < 1000; ++i)