19 #define STDCALL __stdcall
25 #pragma GCC diagnostic ignored "-Wmissing-prototypes"
29 extern __declspec(dllimport) void __stdcall CoTaskMemFree(void *ptr);
32 typedef int (STDCALL *SimpleDelegate) (int a);
34 #if defined(WIN32) && defined (_MSC_VER)
35 #define LIBTEST_API __declspec(dllexport)
36 #elif defined(__GNUC__)
37 #define LIBTEST_API __attribute__ ((visibility ("default")))
42 static void marshal_free (void *ptr)
51 static void* marshal_alloc (gsize size)
54 return CoTaskMemAlloc (size);
56 return g_malloc (size);
60 static void* marshal_alloc0 (gsize size)
63 void* ptr = CoTaskMemAlloc (size);
67 return g_malloc0 (size);
71 static char* marshal_strdup (const char *str)
81 buf = (char *) CoTaskMemAlloc (len + 1);
82 return strcpy (buf, str);
84 return g_strdup (str);
88 static gunichar2* marshal_bstr_alloc(const gchar* str)
91 gunichar2* ret = NULL;
92 gunichar2* temp = NULL;
93 temp = g_utf8_to_utf16 (str, -1, NULL, NULL, NULL);
94 ret = SysAllocString (temp);
99 int slen = strlen (str);
101 /* allocate len + 1 utf16 characters plus 4 byte integer for length*/
102 ret = (gchar *)g_malloc ((slen + 1) * sizeof(gunichar2) + sizeof(guint32));
105 temp = g_utf8_to_utf16 (str, -1, NULL, NULL, NULL);
106 memcpy (ret + sizeof(guint32), temp, slen * sizeof(gunichar2));
107 * ((guint32 *) ret) = slen * sizeof(gunichar2);
108 ret [4 + slen * sizeof(gunichar2)] = 0;
109 ret [5 + slen * sizeof(gunichar2)] = 0;
111 return (gunichar2*)(ret + 4);
115 #define marshal_new0(type,size) ((type *) marshal_alloc0 (sizeof (type)* (size)))
117 LIBTEST_API int STDCALL
118 mono_cominterop_is_supported (void)
120 #if defined(TARGET_X86) || defined(TARGET_AMD64)
126 LIBTEST_API unsigned short* STDCALL
127 test_lpwstr_marshal (unsigned short* chars, long length)
132 res = (unsigned short *)marshal_alloc (2 * (length + 1));
134 // printf("test_lpwstr_marshal()\n");
136 while ( i < length ) {
137 // printf("X|%u|\n", chars[i]);
148 LIBTEST_API void STDCALL
149 test_lpwstr_marshal_out (unsigned short** chars)
152 const char abc[] = "ABC";
153 glong len = strlen(abc);
155 *chars = (unsigned short *)marshal_alloc (2 * (len + 1));
158 (*chars) [i] = abc[i];
171 LIBTEST_API int STDCALL
172 mono_union_test_1 (union_test_1_type u1) {
173 // printf ("Got values %d %d %d\n", u1.b, u1.a, u1.c);
174 return u1.a + u1.b + u1.c;
177 LIBTEST_API int STDCALL
178 mono_return_int (int a) {
179 // printf ("Got value %d\n", a);
183 LIBTEST_API float STDCALL
184 mono_test_marshal_pass_return_float (float f) {
193 LIBTEST_API int STDCALL
194 mono_return_int_ss (struct ss a) {
195 // printf ("Got value %d\n", a.i);
199 LIBTEST_API struct ss STDCALL
200 mono_return_ss (struct ss a) {
201 // printf ("Got value %d\n", a.i);
211 LIBTEST_API struct sc1 STDCALL
212 mono_return_sc1 (struct sc1 a) {
213 // printf ("Got value %d\n", a.c[0]);
224 LIBTEST_API struct sc3 STDCALL
225 mono_return_sc3 (struct sc3 a) {
226 // printf ("Got values %d %d %d\n", a.c[0], a.c[1], a.c[2]);
238 LIBTEST_API struct sc5 STDCALL
239 mono_return_sc5 (struct sc5 a) {
240 // printf ("Got values %d %d %d %d %d\n", a.c[0], a.c[1], a.c[2], a.c[3], a.c[4]);
255 LIBTEST_API int STDCALL
256 mono_return_int_su (union su a) {
257 // printf ("Got value %d\n", a.i1);
272 LIBTEST_API struct NestedFloat STDCALL
273 mono_return_nested_float (void)
275 struct NestedFloat f;
283 LIBTEST_API int STDCALL
284 mono_test_many_int_arguments (int a, int b, int c, int d, int e,
285 int f, int g, int h, int i, int j);
286 LIBTEST_API short STDCALL
287 mono_test_many_short_arguments (short a, short b, short c, short d, short e,
288 short f, short g, short h, short i, short j);
289 LIBTEST_API char STDCALL
290 mono_test_many_char_arguments (char a, char b, char c, char d, char e,
291 char f, char g, char h, char i, char j);
293 LIBTEST_API int STDCALL
294 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)
296 return a + b + c + d + e + f + g + h + i + j;
299 LIBTEST_API short STDCALL
300 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)
302 return a + b + c + d + e + f + g + h + i + j;
305 LIBTEST_API char STDCALL
306 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)
308 return a + b + c + d + e + f + g + h + i + j;
311 LIBTEST_API float STDCALL
312 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)
314 return a + b + c + d + e + f + g + h + i + j;
317 LIBTEST_API double STDCALL
318 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)
320 return a + b + c + d + e + f + g + h + i + j;
323 LIBTEST_API double STDCALL
324 mono_test_split_double_arguments (double a, double b, float c, double d, double e)
326 return a + b + c + d + e;
329 LIBTEST_API int STDCALL
330 mono_test_puts_static (char *s)
332 // printf ("TEST %s\n", s);
336 typedef int (STDCALL *SimpleDelegate3) (int a, int b);
338 LIBTEST_API int STDCALL
339 mono_invoke_delegate (SimpleDelegate3 delegate)
343 // printf ("start invoke %p\n", delegate);
345 res = delegate (2, 3);
347 // printf ("end invoke\n");
352 LIBTEST_API int STDCALL
353 mono_invoke_simple_delegate (SimpleDelegate d)
358 LIBTEST_API int STDCALL
359 mono_test_marshal_char (short a1)
367 LIBTEST_API void STDCALL
368 mono_test_marshal_char_array (gunichar2 *s)
370 const char m[] = "abcdef";
374 s2 = g_utf8_to_utf16 (m, -1, NULL, &len, NULL);
382 LIBTEST_API int STDCALL
383 mono_test_marshal_ansi_char_array (char *s)
385 const char m[] = "abcdef";
387 if (strncmp ("qwer", s, 4))
390 memcpy (s, m, sizeof (m));
394 LIBTEST_API int STDCALL
395 mono_test_marshal_unicode_char_array (gunichar2 *s)
397 const char m[] = "abcdef";
398 const char expected[] = "qwer";
402 s1 = g_utf8_to_utf16 (m, -1, NULL, &len1, NULL);
403 s2 = g_utf8_to_utf16 (expected, -1, NULL, &len2, NULL);
407 if (memcmp (s, s2, len2))
410 memcpy (s, s1, len1);
414 LIBTEST_API int STDCALL
415 mono_test_empty_pinvoke (int i)
420 LIBTEST_API int STDCALL
421 mono_test_marshal_bool_byref (int a, int *b, int c)
430 LIBTEST_API int STDCALL
431 mono_test_marshal_bool_in_as_I1_U1 (char bTrue, char bFalse)
440 LIBTEST_API int STDCALL
441 mono_test_marshal_bool_out_as_I1_U1 (char* bTrue, char* bFalse)
443 if (!bTrue || !bFalse)
452 LIBTEST_API int STDCALL
453 mono_test_marshal_bool_ref_as_I1_U1 (char* bTrue, char* bFalse)
455 if (!bTrue || !bFalse)
469 LIBTEST_API int STDCALL
470 mono_test_marshal_array (int *a1)
474 for (i = 0; i < 50; i++)
480 LIBTEST_API int STDCALL
481 mono_test_marshal_inout_array (int *a1)
485 for (i = 0; i < 50; i++) {
487 a1 [i] = 50 - a1 [i];
493 LIBTEST_API int /* cdecl */
494 mono_test_marshal_inout_array_cdecl (int *a1)
496 return mono_test_marshal_inout_array (a1);
499 LIBTEST_API int STDCALL
500 mono_test_marshal_out_array (int *a1)
504 for (i = 0; i < 50; i++) {
511 LIBTEST_API int STDCALL
512 mono_test_marshal_out_byref_array_out_size_param (int **out_arr, int *out_len)
518 arr = (gint32 *)marshal_alloc (sizeof (gint32) * len);
519 for (i = 0; i < len; ++i)
527 LIBTEST_API int STDCALL
528 mono_test_marshal_out_lparray_out_size_param (int *arr, int *out_len)
533 for (i = 0; i < len; ++i)
540 LIBTEST_API int STDCALL
541 mono_test_marshal_inout_nonblittable_array (gunichar2 *a1)
545 for (i = 0; i < 10; i++) {
565 LIBTEST_API simplestruct STDCALL
566 mono_test_return_vtype (int i)
569 static gunichar2 test2 [] = { 'T', 'E', 'S', 'T', '2', 0 };
580 LIBTEST_API void STDCALL
581 mono_test_delegate_struct (void)
583 // printf ("TEST\n");
586 typedef char* (STDCALL *ReturnStringDelegate) (const char *s);
588 LIBTEST_API char * STDCALL
589 mono_test_return_string (ReturnStringDelegate func)
593 // printf ("mono_test_return_string\n");
598 // printf ("got string: %s\n", res);
599 return marshal_strdup ("12345");
602 typedef int (STDCALL *RefVTypeDelegate) (int a, simplestruct *ss, int b);
604 LIBTEST_API int STDCALL
605 mono_test_ref_vtype (int a, simplestruct *ss, int b, RefVTypeDelegate func)
607 if (a == 1 && b == 2 && ss->a == 0 && ss->b == 1 && ss->c == 0 &&
608 !strcmp (ss->d, "TEST1")) {
614 return func (a, ss, b);
620 typedef int (STDCALL *OutVTypeDelegate) (int a, simplestruct *ss, int b);
622 LIBTEST_API int STDCALL
623 mono_test_marshal_out_struct (int a, simplestruct *ss, int b, OutVTypeDelegate func)
625 /* Check that the input pointer is ignored */
626 ss->d = (const char *)0x12345678;
630 if (ss->a && ss->b && ss->c && !strcmp (ss->d, "TEST3"))
636 typedef int (STDCALL *InVTypeDelegate) (int a, simplestruct *ss, int b);
638 LIBTEST_API int STDCALL
639 mono_test_marshal_in_struct (int a, simplestruct *ss, int b, InVTypeDelegate func)
644 memcpy (&ss2, ss, sizeof (simplestruct));
646 res = func (a, ss, b);
648 printf ("mono_test_marshal_in_struct () failed: %d\n", res);
652 /* Check that no modifications is made to the struct */
653 if (ss2.a == ss->a && ss2.b == ss->b && ss2.c == ss->c && ss2.d == ss->d)
661 SimpleDelegate func, func2, func3;
664 LIBTEST_API DelegateStruct STDCALL
665 mono_test_marshal_delegate_struct (DelegateStruct ds)
669 res.a = ds.func (ds.a) + ds.func2 (ds.a) + (ds.func3 == NULL ? 0 : 1);
671 res.func2 = ds.func2;
677 LIBTEST_API int STDCALL
678 mono_test_marshal_struct (simplestruct ss)
680 if (ss.a == 0 && ss.b == 1 && ss.c == 0 &&
681 !strcmp (ss.d, "TEST"))
687 LIBTEST_API int STDCALL
688 mono_test_marshal_byref_struct (simplestruct *ss, int a, int b, int c, char *d)
690 gboolean res = (ss->a == a && ss->b == b && ss->c == c && strcmp (ss->d, d) == 0);
692 marshal_free ((char*)ss->d);
697 ss->d = marshal_strdup ("DEF");
713 LIBTEST_API int STDCALL
714 mono_test_marshal_struct2 (simplestruct2 ss)
716 if (ss.a == 0 && ss.b == 1 && ss.c == 0 &&
717 !strcmp (ss.d, "TEST") &&
718 ss.e == 99 && ss.f == 1.5 && ss.g == 42 && ss.h == (guint64)123)
724 /* on HP some of the struct should be on the stack and not in registers */
725 LIBTEST_API int STDCALL
726 mono_test_marshal_struct2_2 (int i, int j, int k, simplestruct2 ss)
728 if (i != 10 || j != 11 || k != 12)
730 if (ss.a == 0 && ss.b == 1 && ss.c == 0 &&
731 !strcmp (ss.d, "TEST") &&
732 ss.e == 99 && ss.f == 1.5 && ss.g == 42 && ss.h == (guint64)123)
738 LIBTEST_API int STDCALL
739 mono_test_marshal_lpstruct (simplestruct *ss)
741 if (ss->a == 0 && ss->b == 1 && ss->c == 0 &&
742 !strcmp (ss->d, "TEST"))
748 LIBTEST_API int STDCALL
749 mono_test_marshal_lpstruct_blittable (point *p)
751 if (p->x == 1.0 && p->y == 2.0)
757 LIBTEST_API int STDCALL
758 mono_test_marshal_struct_array (simplestruct2 *ss)
760 if (! (ss[0].a == 0 && ss[0].b == 1 && ss[0].c == 0 &&
761 !strcmp (ss[0].d, "TEST") &&
762 ss[0].e == 99 && ss[0].f == 1.5 && ss[0].g == 42 && ss[0].h == (guint64)123))
765 if (! (ss[1].a == 0 && ss[1].b == 0 && ss[1].c == 0 &&
766 !strcmp (ss[1].d, "TEST2") &&
767 ss[1].e == 100 && ss[1].f == 2.5 && ss[1].g == 43 && ss[1].h == (guint64)124))
773 typedef struct long_align_struct {
779 LIBTEST_API int STDCALL
780 mono_test_marshal_long_align_struct_array (long_align_struct *ss)
782 return ss[0].a + ss[0].b + ss[0].c + ss[1].a + ss[1].b + ss[1].c;
785 LIBTEST_API simplestruct2 * STDCALL
786 mono_test_marshal_class (int i, int j, int k, simplestruct2 *ss, int l)
793 if (i != 10 || j != 11 || k != 12 || l != 14)
795 if (! (ss->a == 0 && ss->b == 1 && ss->c == 0 &&
796 !strcmp (ss->d, "TEST") &&
797 ss->e == 99 && ss->f == 1.5 && ss->g == 42 && ss->h == (guint64)123))
800 res = marshal_new0 (simplestruct2, 1);
801 memcpy (res, ss, sizeof (simplestruct2));
802 res->d = marshal_strdup ("TEST");
806 LIBTEST_API int STDCALL
807 mono_test_marshal_byref_class (simplestruct2 **ssp)
809 simplestruct2 *ss = *ssp;
812 if (! (ss->a == 0 && ss->b == 1 && ss->c == 0 &&
813 !strcmp (ss->d, "TEST") &&
814 ss->e == 99 && ss->f == 1.5 && ss->g == 42 && ss->h == (guint64)123))
817 res = marshal_new0 (simplestruct2, 1);
818 memcpy (res, ss, sizeof (simplestruct2));
819 res->d = marshal_strdup ("TEST-RES");
831 /* Yes, this is correct, we are only trying to determine the value of the stack here */
836 LIBTEST_API int STDCALL
837 reliable_delegate (int a)
843 * Checks whether get_sp() works as expected. It doesn't work with gcc-2.95.3 on linux.
846 is_get_sp_reliable (void)
850 reliable_delegate(1);
852 reliable_delegate(1);
857 LIBTEST_API int STDCALL
858 mono_test_marshal_delegate (SimpleDelegate delegate)
862 /* Check that the delegate wrapper is stdcall */
867 if (is_get_sp_reliable())
868 g_assert (sp1 == sp2);
873 static int STDCALL inc_cb (int i)
878 LIBTEST_API int STDCALL
879 mono_test_marshal_out_delegate (SimpleDelegate *delegate)
886 LIBTEST_API SimpleDelegate STDCALL
887 mono_test_marshal_return_delegate (SimpleDelegate delegate)
892 typedef int DelegateByrefDelegate (void *);
894 LIBTEST_API int STDCALL
895 mono_test_marshal_delegate_ref_delegate (DelegateByrefDelegate del)
905 return_plus_one (int i)
910 LIBTEST_API SimpleDelegate STDCALL
911 mono_test_marshal_return_delegate_2 (void)
913 return return_plus_one;
916 typedef simplestruct (STDCALL *SimpleDelegate2) (simplestruct ss);
919 is_utf16_equals (gunichar2 *s1, const char *s2)
924 s = g_utf16_to_utf8 (s1, -1, NULL, NULL, NULL);
925 res = strcmp (s, s2);
931 LIBTEST_API int STDCALL
932 mono_test_marshal_delegate2 (SimpleDelegate2 delegate)
934 simplestruct ss, res;
940 ss.d2 = g_utf8_to_utf16 ("TEST2", -1, NULL, NULL, NULL);
943 if (! (res.a && !res.b && res.c && !strcmp (res.d, "TEST-RES") && is_utf16_equals (res.d2, "TEST2-RES")))
949 typedef simplestruct* (STDCALL *SimpleDelegate4) (simplestruct *ss);
951 LIBTEST_API int STDCALL
952 mono_test_marshal_delegate4 (SimpleDelegate4 delegate)
963 res = delegate (&ss);
967 /* Check return value */
968 if (! (!res->a && res->b && !res->c && !strcmp (res->d, "TEST")))
971 /* Check NULL argument and NULL result */
972 res = delegate (NULL);
979 typedef int (STDCALL *SimpleDelegate5) (simplestruct **ss);
981 LIBTEST_API int STDCALL
982 mono_test_marshal_delegate5 (SimpleDelegate5 delegate)
995 res = delegate (&ptr);
999 if (!(ptr->a && !ptr->b && ptr->c && !strcmp (ptr->d, "RES")))
1005 LIBTEST_API int STDCALL
1006 mono_test_marshal_delegate6 (SimpleDelegate5 delegate)
1012 typedef int (STDCALL *SimpleDelegate7) (simplestruct **ss);
1014 LIBTEST_API int STDCALL
1015 mono_test_marshal_delegate7 (SimpleDelegate7 delegate)
1020 /* Check that the input pointer is ignored */
1021 ptr = (simplestruct *)0x12345678;
1023 res = delegate (&ptr);
1027 if (!(ptr->a && !ptr->b && ptr->c && !strcmp (ptr->d, "RES")))
1033 typedef int (STDCALL *InOutByvalClassDelegate) (simplestruct *ss);
1035 LIBTEST_API int STDCALL
1036 mono_test_marshal_inout_byval_class_delegate (InOutByvalClassDelegate delegate)
1044 ss.d = g_strdup_printf ("%s", "FOO");
1046 res = delegate (&ss);
1050 if (!(ss.a && !ss.b && ss.c && !strcmp (ss.d, "RES")))
1056 typedef int (STDCALL *SimpleDelegate8) (gunichar2 *s);
1058 LIBTEST_API int STDCALL
1059 mono_test_marshal_delegate8 (SimpleDelegate8 delegate, gunichar2 *s)
1061 return delegate (s);
1064 typedef int (STDCALL *return_int_fnt) (int i);
1065 typedef int (STDCALL *SimpleDelegate9) (return_int_fnt d);
1067 LIBTEST_API int STDCALL
1068 mono_test_marshal_delegate9 (SimpleDelegate9 delegate, gpointer ftn)
1070 return delegate ((return_int_fnt)ftn);
1079 LIBTEST_API int STDCALL
1080 mono_test_marshal_delegate10 (SimpleDelegate9 delegate)
1082 return delegate (return_self);
1085 typedef int (STDCALL *PrimitiveByrefDelegate) (int *i);
1087 LIBTEST_API int STDCALL
1088 mono_test_marshal_primitive_byref_delegate (PrimitiveByrefDelegate delegate)
1092 int res = delegate (&i);
1102 typedef int (STDCALL *return_int_delegate) (int i);
1104 typedef return_int_delegate (STDCALL *ReturnDelegateDelegate) (void);
1106 LIBTEST_API int STDCALL
1107 mono_test_marshal_return_delegate_delegate (ReturnDelegateDelegate d)
1112 typedef int (STDCALL *VirtualDelegate) (int);
1114 LIBTEST_API int STDCALL
1115 mono_test_marshal_virtual_delegate (VirtualDelegate del)
1120 LIBTEST_API int STDCALL
1121 mono_test_marshal_stringbuilder (char *s, int n)
1123 const char m[] = "This is my message. Isn't it nice?";
1125 if (strcmp (s, "ABCD") != 0)
1132 LIBTEST_API int STDCALL
1133 mono_test_marshal_stringbuilder_append (char *s, int length)
1135 const char out_sentinel[] = "CSHARP_";
1136 const char out_len = strlen (out_sentinel);
1138 for (int i=0; i < length; i++) {
1139 s [i] = out_sentinel [i % out_len];
1148 LIBTEST_API int STDCALL
1149 mono_test_marshal_stringbuilder_default (char *s, int n)
1151 const char m[] = "This is my message. Isn't it nice?";
1158 LIBTEST_API int STDCALL
1159 mono_test_marshal_stringbuilder_unicode (gunichar2 *s, int n)
1161 const char m[] = "This is my message. Isn't it nice?";
1165 s2 = g_utf8_to_utf16 (m, -1, NULL, &len, NULL);
1167 len = (len * 2) + 2;
1170 memcpy (s, s2, len);
1177 LIBTEST_API void STDCALL
1178 mono_test_marshal_stringbuilder_out (char **s)
1180 const char m[] = "This is my message. Isn't it nice?";
1183 str = (char *)marshal_alloc (strlen (m) + 1);
1184 memcpy (str, m, strlen (m) + 1);
1189 LIBTEST_API int STDCALL
1190 mono_test_marshal_stringbuilder_out_unicode (gunichar2 **s)
1192 const char m[] = "This is my message. Isn't it nice?";
1196 s2 = g_utf8_to_utf16 (m, -1, NULL, &len, NULL);
1198 len = (len * 2) + 2;
1199 *s = (gunichar2 *)marshal_alloc (len);
1200 memcpy (*s, s2, len);
1207 LIBTEST_API int STDCALL
1208 mono_test_marshal_stringbuilder_ref (char **s)
1210 const char m[] = "This is my message. Isn't it nice?";
1213 if (strcmp (*s, "ABC"))
1216 str = (char *)marshal_alloc (strlen (m) + 1);
1217 memcpy (str, m, strlen (m) + 1);
1223 #pragma GCC diagnostic push
1224 #pragma GCC diagnostic ignored "-Wc++-compat"
1230 #pragma GCC diagnostic pop
1232 LIBTEST_API int STDCALL
1233 mono_test_marshal_empty_string_array (char **array)
1235 return (array == NULL) ? 0 : 1;
1238 LIBTEST_API int STDCALL
1239 mono_test_marshal_string_array (char **array)
1241 if (strcmp (array [0], "ABC"))
1243 if (strcmp (array [1], "DEF"))
1246 if (array [2] != NULL)
1252 LIBTEST_API int STDCALL
1253 mono_test_marshal_byref_string_array (char ***array)
1258 if (strcmp ((*array) [0], "Alpha"))
1260 if (strcmp ((*array) [1], "Beta"))
1262 if (strcmp ((*array) [2], "Gamma"))
1268 LIBTEST_API int STDCALL
1269 mono_test_marshal_stringbuilder_array (char **array)
1271 if (strcmp (array [0], "ABC"))
1273 if (strcmp (array [1], "DEF"))
1276 strcpy (array [0], "DEF");
1277 strcpy (array [1], "ABC");
1282 LIBTEST_API int STDCALL
1283 mono_test_marshal_unicode_string_array (gunichar2 **array, char **array2)
1285 GError *error = NULL;
1288 s = g_utf16_to_utf8 (array [0], -1, NULL, NULL, &error);
1289 if (strcmp (s, "ABC")) {
1296 s = g_utf16_to_utf8 (array [1], -1, NULL, NULL, &error);
1297 if (strcmp (s, "DEF")) {
1304 if (strcmp (array2 [0], "ABC"))
1307 if (strcmp (array2 [1], "DEF"))
1313 /* this does not work on Redhat gcc 2.96 */
1314 LIBTEST_API int STDCALL
1315 mono_test_empty_struct (int a, EmptyStruct es, int b)
1317 // printf ("mono_test_empty_struct %d %d\n", a, b);
1319 // Intel icc on ia64 passes 'es' in 2 registers
1320 #if defined(__ia64) && defined(__INTEL_COMPILER)
1323 if (a == 1 && b == 2)
1329 LIBTEST_API EmptyStruct STDCALL
1330 mono_test_return_empty_struct (int a)
1343 LIBTEST_API ByValStrStruct * STDCALL
1344 mono_test_byvalstr_gen (void)
1346 ByValStrStruct *ret;
1348 ret = (ByValStrStruct *)malloc (sizeof (ByValStrStruct));
1349 memset(ret, 'a', sizeof(ByValStrStruct)-1);
1350 ret->a[sizeof(ByValStrStruct)-1] = 0;
1355 LIBTEST_API int STDCALL
1356 mono_test_byvalstr_check (ByValStrStruct* data, char* correctString)
1360 ret = strcmp(data->a, correctString);
1361 // printf ("T1: %s\n", data->a);
1362 // printf ("T2: %s\n", correctString);
1364 /* we need g_free because the allocation was performed by mono_test_byvalstr_gen */
1372 } ByValStrStruct_Unicode;
1374 LIBTEST_API int STDCALL
1375 mono_test_byvalstr_check_unicode (ByValStrStruct_Unicode *ref, int test)
1377 if (ref->flag != 0x1234abcd){
1378 printf ("overwritten data");
1382 if (test == 1 || test == 3){
1383 if (ref->a [0] != '1' ||
1384 ref->a [1] != '2' ||
1390 if (ref->a [0] != '1' ||
1398 LIBTEST_API int STDCALL
1399 NameManglingAnsi (char *data)
1401 return data [0] + data [1] + data [2];
1404 LIBTEST_API int STDCALL
1405 NameManglingAnsiA (char *data)
1407 g_assert_not_reached ();
1410 LIBTEST_API int STDCALL
1411 NameManglingAnsiW (char *data)
1413 g_assert_not_reached ();
1416 LIBTEST_API int STDCALL
1417 NameManglingAnsi2A (char *data)
1419 return data [0] + data [1] + data [2];
1422 LIBTEST_API int STDCALL
1423 NameManglingAnsi2W (char *data)
1425 g_assert_not_reached ();
1428 LIBTEST_API int STDCALL
1429 NameManglingUnicode (char *data)
1431 g_assert_not_reached ();
1434 LIBTEST_API int STDCALL
1435 NameManglingUnicodeW (gunichar2 *data)
1437 return data [0] + data [1] + data [2];
1440 LIBTEST_API int STDCALL
1441 NameManglingUnicode2 (gunichar2 *data)
1443 return data [0] + data [1] + data [2];
1446 LIBTEST_API int STDCALL
1447 NameManglingAutoW (char *data)
1450 return (data [0] + data [1] + data [2]) == 131 ? 0 : 1;
1452 g_assert_not_reached ();
1456 LIBTEST_API int STDCALL
1457 NameManglingAuto (char *data)
1460 return (data [0] + data [1] + data [2]) == 198 ? 0 : 1;
1462 g_assert_not_reached ();
1466 typedef int (STDCALL *intcharFunc)(const char*);
1468 LIBTEST_API void STDCALL
1469 callFunction (intcharFunc f)
1479 LIBTEST_API int STDCALL
1480 class_marshal_test0 (SimpleObj *obj1)
1482 // printf ("class_marshal_test0 %s %d\n", obj1->str, obj1->i);
1484 if (strcmp(obj1->str, "T1"))
1492 LIBTEST_API int STDCALL
1493 class_marshal_test4 (SimpleObj *obj1)
1501 LIBTEST_API void STDCALL
1502 class_marshal_test1 (SimpleObj **obj1)
1504 SimpleObj *res = (SimpleObj *)malloc (sizeof (SimpleObj));
1506 res->str = marshal_strdup ("ABC");
1512 LIBTEST_API int STDCALL
1513 class_marshal_test2 (SimpleObj **obj1)
1515 // printf ("class_marshal_test2 %s %d\n", (*obj1)->str, (*obj1)->i);
1517 if (strcmp((*obj1)->str, "ABC"))
1519 if ((*obj1)->i != 5)
1525 LIBTEST_API int STDCALL
1526 string_marshal_test0 (char *str)
1528 if (strcmp (str, "TEST0"))
1534 LIBTEST_API void STDCALL
1535 string_marshal_test1 (const char **str)
1537 *str = marshal_strdup ("TEST1");
1540 LIBTEST_API int STDCALL
1541 string_marshal_test2 (char **str)
1543 // printf ("string_marshal_test2 %s\n", *str);
1545 if (strcmp (*str, "TEST1"))
1548 *str = marshal_strdup ("TEST2");
1553 LIBTEST_API int STDCALL
1554 string_marshal_test3 (char *str)
1567 LIBTEST_API BlittableClass* STDCALL
1568 TestBlittableClass (BlittableClass *vl)
1570 BlittableClass *res;
1572 // printf ("TestBlittableClass %d %d\n", vl->a, vl->b);
1578 res = marshal_new0 (BlittableClass, 1);
1579 memcpy (res, vl, sizeof (BlittableClass));
1581 res = marshal_new0 (BlittableClass, 1);
1589 typedef struct OSVERSIONINFO_STRUCT
1593 } OSVERSIONINFO_STRUCT;
1595 LIBTEST_API int STDCALL
1596 MyGetVersionEx (OSVERSIONINFO_STRUCT *osvi)
1599 // printf ("GOT %d %d\n", osvi->a, osvi->b);
1604 return osvi->a + osvi->b;
1607 LIBTEST_API int STDCALL
1608 BugGetVersionEx (int a, int b, int c, int d, int e, int f, int g, int h, OSVERSIONINFO_STRUCT *osvi)
1611 // printf ("GOT %d %d\n", osvi->a, osvi->b);
1616 return osvi->a + osvi->b;
1619 LIBTEST_API int STDCALL
1620 mono_test_marshal_point (point pt)
1622 // printf("point %g %g\n", pt.x, pt.y);
1623 if (pt.x == 1.25 && pt.y == 3.5)
1634 LIBTEST_API int STDCALL
1635 mono_test_marshal_mixed_point (mixed_point pt)
1637 // printf("mixed point %d %g\n", pt.x, pt.y);
1638 if (pt.x == 5 && pt.y == 6.75)
1644 LIBTEST_API int STDCALL
1645 mono_test_marshal_mixed_point_2 (mixed_point *pt)
1647 if (pt->x != 5 || pt->y != 6.75)
1656 LIBTEST_API int STDCALL
1657 marshal_test_ref_bool(int i, char *b1, short *b2, int *b3)
1660 if (*b1 != 0 && *b1 != 1)
1662 if (*b2 != 0 && *b2 != -1) /* variant_bool */
1664 if (*b3 != 0 && *b3 != 1)
1666 if (i == ((*b1 << 2) | (-*b2 << 1) | *b3))
1678 short b2; /* variant_bool */
1682 LIBTEST_API int STDCALL
1683 marshal_test_bool_struct(struct BoolStruct *s)
1686 if (s->b1 != 0 && s->b1 != 1)
1688 if (s->b2 != 0 && s->b2 != -1)
1690 if (s->b3 != 0 && s->b3 != 1)
1692 if (s->i == ((s->b1 << 2) | (-s->b2 << 1) | s->b3))
1709 LIBTEST_API int STDCALL
1710 mono_test_marshal_long_struct (LongStruct *s)
1712 return s->i + s->l.l;
1715 LIBTEST_API void STDCALL
1716 mono_test_last_error (int err)
1725 LIBTEST_API int STDCALL
1726 mono_test_asany (void *ptr, int what)
1730 return (*(int*)ptr == 5) ? 0 : 1;
1732 return strcmp (ptr, "ABC") == 0 ? 0 : 1;
1734 simplestruct2 ss = *(simplestruct2*)ptr;
1736 if (ss.a == 0 && ss.b == 1 && ss.c == 0 &&
1737 !strcmp (ss.d, "TEST") &&
1738 ss.e == 99 && ss.f == 1.5 && ss.g == 42 && ss.h == (guint64)123)
1744 GError *error = NULL;
1747 s = g_utf16_to_utf8 ((const gunichar2 *)ptr, -1, NULL, NULL, &error);
1752 if (!strcmp (s, "ABC")) {
1762 g_assert_not_reached ();
1776 LIBTEST_API int STDCALL
1777 mono_test_marshal_asany_in (void* ptr)
1779 AsAnyStruct *asAny = (AsAnyStruct *)ptr;
1780 int res = asAny->i + asAny->j + asAny->k;
1785 LIBTEST_API int STDCALL
1786 mono_test_marshal_asany_inout (void* ptr)
1788 AsAnyStruct *asAny = (AsAnyStruct *)ptr;
1789 int res = asAny->i + asAny->j + asAny->k;
1791 marshal_free (asAny->s);
1801 LIBTEST_API int STDCALL
1802 mono_test_marshal_asany_out (void* ptr)
1804 AsAnyStruct *asAny = (AsAnyStruct *)ptr;
1805 int res = asAny->i + asAny->j + asAny->k;
1816 * AMD64 marshalling tests.
1819 typedef struct amd64_struct1 {
1826 LIBTEST_API amd64_struct1 STDCALL
1827 mono_test_marshal_amd64_pass_return_struct1 (amd64_struct1 s)
1837 LIBTEST_API amd64_struct1 STDCALL
1838 mono_test_marshal_amd64_pass_return_struct1_many_args (amd64_struct1 s, int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8)
1843 s.l += 1 + i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8;
1848 typedef struct amd64_struct2 {
1853 LIBTEST_API amd64_struct2 STDCALL
1854 mono_test_marshal_amd64_pass_return_struct2 (amd64_struct2 s)
1862 typedef struct amd64_struct3 {
1866 LIBTEST_API amd64_struct3 STDCALL
1867 mono_test_marshal_amd64_pass_return_struct3 (amd64_struct3 s)
1874 typedef struct amd64_struct4 {
1878 LIBTEST_API amd64_struct4 STDCALL
1879 mono_test_marshal_amd64_pass_return_struct4 (amd64_struct4 s)
1888 * IA64 marshalling tests.
1890 typedef struct test_struct5 {
1894 LIBTEST_API test_struct5 STDCALL
1895 mono_test_marshal_ia64_pass_return_struct5 (double d1, double d2, test_struct5 s, int i, double d3, double d4)
1897 s.d1 += d1 + d2 + i;
1898 s.d2 += d3 + d4 + i;
1903 typedef struct test_struct6 {
1907 LIBTEST_API test_struct6 STDCALL
1908 mono_test_marshal_ia64_pass_return_struct6 (double d1, double d2, test_struct6 s, int i, double d3, double d4)
1910 s.d1 += d1 + d2 + i;
1916 static guint32 custom_res [2];
1918 LIBTEST_API void* STDCALL
1919 mono_test_marshal_pass_return_custom (int i, guint32 *ptr, int j)
1921 /* ptr will be freed by CleanupNative, so make a copy */
1922 custom_res [0] = 0; /* not allocated by AllocHGlobal */
1923 custom_res [1] = ptr [1];
1928 LIBTEST_API int STDCALL
1929 mono_test_marshal_pass_out_custom (int i, guint32 **ptr, int j)
1932 custom_res [1] = i + j + 10;
1939 LIBTEST_API int STDCALL
1940 mono_test_marshal_pass_inout_custom (int i, guint32 *ptr, int j)
1943 ptr [1] = i + ptr [1] + j;
1948 LIBTEST_API int STDCALL
1949 mono_test_marshal_pass_out_byval_custom (int i, guint32 *ptr, int j)
1951 return ptr == NULL ? 0 : 1;
1954 LIBTEST_API int STDCALL
1955 mono_test_marshal_pass_byref_custom (int i, guint32 **ptr, int j)
1962 LIBTEST_API void* STDCALL
1963 mono_test_marshal_pass_return_custom2 (int i, guint32 *ptr, int j)
1965 g_assert_not_reached ();
1970 LIBTEST_API void* STDCALL
1971 mono_test_marshal_pass_return_custom_null (int i, guint32 *ptr, int j)
1973 g_assert (ptr == NULL);
1978 typedef void *(STDCALL *PassReturnPtrDelegate) (void *ptr);
1980 LIBTEST_API int STDCALL
1981 mono_test_marshal_pass_return_custom_in_delegate (PassReturnPtrDelegate del)
1990 ptr = (guint32 *)del (&buf);
1995 /* FIXME: Freed with FreeHGlobal */
2003 LIBTEST_API int STDCALL
2004 mono_test_marshal_pass_return_custom_null_in_delegate (PassReturnPtrDelegate del)
2006 void *ptr = del (NULL);
2008 return (ptr == NULL) ? 15 : 0;
2011 typedef void (STDCALL *CustomOutParamDelegate) (void **pptr);
2013 LIBTEST_API int STDCALL
2014 mono_test_marshal_custom_out_param_delegate (CustomOutParamDelegate del)
2026 typedef int (STDCALL *ReturnEnumDelegate) (int e);
2028 LIBTEST_API int STDCALL
2029 mono_test_marshal_return_enum_delegate (ReturnEnumDelegate func)
2039 typedef BlittableStruct (STDCALL *SimpleDelegate10) (BlittableStruct ss);
2041 LIBTEST_API int STDCALL
2042 mono_test_marshal_blittable_struct_delegate (SimpleDelegate10 delegate)
2044 BlittableStruct ss, res;
2051 res = delegate (ss);
2052 if (! ((res.a == -1) && (res.b == -2) && (res.c == -3) && (res.d == -55)))
2058 LIBTEST_API int STDCALL
2059 mono_test_stdcall_name_mangling (int a, int b, int c)
2065 mono_test_stdcall_mismatch_1 (int a, int b, int c)
2070 LIBTEST_API int STDCALL
2071 mono_test_stdcall_mismatch_2 (int a, int b, int c)
2077 * PASSING AND RETURNING SMALL STRUCTURES FROM DELEGATES TESTS
2084 typedef SmallStruct1 (STDCALL *SmallStructDelegate1) (SmallStruct1 ss);
2086 LIBTEST_API int STDCALL
2087 mono_test_marshal_small_struct_delegate1 (SmallStructDelegate1 delegate)
2089 SmallStruct1 ss, res;
2093 res = delegate (ss);
2094 if (! (res.i == -1))
2104 typedef SmallStruct2 (STDCALL *SmallStructDelegate2) (SmallStruct2 ss);
2106 LIBTEST_API int STDCALL
2107 mono_test_marshal_small_struct_delegate2 (SmallStructDelegate2 delegate)
2109 SmallStruct2 ss, res;
2114 res = delegate (ss);
2115 if (! ((res.i == -2) && (res.j == -3)))
2126 typedef SmallStruct3 (STDCALL *SmallStructDelegate3) (SmallStruct3 ss);
2128 LIBTEST_API int STDCALL
2129 mono_test_marshal_small_struct_delegate3 (SmallStructDelegate3 delegate)
2131 SmallStruct3 ss, res;
2136 res = delegate (ss);
2137 if (! ((res.i == -1) && (res.j == -2)))
2147 typedef SmallStruct4 (STDCALL *SmallStructDelegate4) (SmallStruct4 ss);
2149 LIBTEST_API int STDCALL
2150 mono_test_marshal_small_struct_delegate4 (SmallStructDelegate4 delegate)
2152 SmallStruct4 ss, res;
2156 res = delegate (ss);
2157 if (! (res.i == -1))
2167 typedef SmallStruct5 (STDCALL *SmallStructDelegate5) (SmallStruct5 ss);
2169 LIBTEST_API int STDCALL
2170 mono_test_marshal_small_struct_delegate5 (SmallStructDelegate5 delegate)
2172 SmallStruct5 ss, res;
2176 res = delegate (ss);
2177 if (! (res.i == -5))
2187 typedef SmallStruct6 (STDCALL *SmallStructDelegate6) (SmallStruct6 ss);
2189 LIBTEST_API int STDCALL
2190 mono_test_marshal_small_struct_delegate6 (SmallStructDelegate6 delegate)
2192 SmallStruct6 ss, res;
2197 res = delegate (ss);
2198 if (! ((res.i == -1) && (res.j == -2)))
2209 typedef SmallStruct7 (STDCALL *SmallStructDelegate7) (SmallStruct7 ss);
2211 LIBTEST_API int STDCALL
2212 mono_test_marshal_small_struct_delegate7 (SmallStructDelegate7 delegate)
2214 SmallStruct7 ss, res;
2219 res = delegate (ss);
2220 if (! ((res.i == -1) && (res.j == -2)))
2230 typedef SmallStruct8 (STDCALL *SmallStructDelegate8) (SmallStruct8 ss);
2232 LIBTEST_API int STDCALL
2233 mono_test_marshal_small_struct_delegate8 (SmallStructDelegate8 delegate)
2235 SmallStruct8 ss, res;
2239 res = delegate (ss);
2240 if (! ((res.i == -1.0)))
2250 typedef SmallStruct9 (STDCALL *SmallStructDelegate9) (SmallStruct9 ss);
2252 LIBTEST_API int STDCALL
2253 mono_test_marshal_small_struct_delegate9 (SmallStructDelegate9 delegate)
2255 SmallStruct9 ss, res;
2259 res = delegate (ss);
2260 if (! ((res.i == -1.0)))
2270 typedef SmallStruct10 (STDCALL *SmallStructDelegate10) (SmallStruct10 ss);
2272 LIBTEST_API int STDCALL
2273 mono_test_marshal_small_struct_delegate10 (SmallStructDelegate10 delegate)
2275 SmallStruct10 ss, res;
2280 res = delegate (ss);
2281 if (! ((res.i == -1.0) && (res.j == -2.0)))
2292 typedef SmallStruct11 (STDCALL *SmallStructDelegate11) (SmallStruct11 ss);
2294 LIBTEST_API int STDCALL
2295 mono_test_marshal_small_struct_delegate11 (SmallStructDelegate11 delegate)
2297 SmallStruct11 ss, res;
2302 res = delegate (ss);
2303 if (! ((res.i == -1.0) && (res.j == -2)))
2309 typedef int (STDCALL *ArrayDelegate) (int i, char *j, void *arr);
2311 LIBTEST_API int STDCALL
2312 mono_test_marshal_array_delegate (void *arr, int len, ArrayDelegate del)
2314 return del (len, NULL, arr);
2317 typedef int (STDCALL *ArrayDelegateLong) (gint64 i, char *j, void *arr);
2319 LIBTEST_API int STDCALL
2320 mono_test_marshal_array_delegate_long (void *arr, gint64 len, ArrayDelegateLong del)
2322 return del (len, NULL, arr);
2325 LIBTEST_API int STDCALL
2326 mono_test_marshal_out_array_delegate (int *arr, int len, ArrayDelegate del)
2328 del (len, NULL, arr);
2330 if ((arr [0] != 1) || (arr [1] != 2))
2336 typedef gunichar2* (STDCALL *UnicodeStringDelegate) (gunichar2 *message);
2338 LIBTEST_API int STDCALL
2339 mono_test_marshal_return_unicode_string_delegate (UnicodeStringDelegate del)
2341 const char m[] = "abcdef";
2342 gunichar2 *s2, *res;
2345 s2 = g_utf8_to_utf16 (m, -1, NULL, &len, NULL);
2354 LIBTEST_API int STDCALL
2355 mono_test_marshal_out_string_array_delegate (char **arr, int len, ArrayDelegate del)
2357 del (len, NULL, arr);
2359 if (!strcmp (arr [0], "ABC") && !strcmp (arr [1], "DEF"))
2365 typedef int (*CdeclDelegate) (int i, int j);
2367 LIBTEST_API int STDCALL
2368 mono_test_marshal_cdecl_delegate (CdeclDelegate del)
2372 for (i = 0; i < 1000; ++i)
2378 typedef char** (STDCALL *ReturnStringArrayDelegate) (int i);
2380 LIBTEST_API int STDCALL
2381 mono_test_marshal_return_string_array_delegate (ReturnStringArrayDelegate d)
2389 if (strcmp (arr [0], "ABC") || strcmp (arr [1], "DEF"))
2399 typedef int (STDCALL *ByrefStringDelegate) (char **s);
2401 LIBTEST_API int STDCALL
2402 mono_test_marshal_byref_string_delegate (ByrefStringDelegate d)
2404 char *s = (char*)"ABC";
2411 if (!strcmp (s, "DEF"))
2421 LIBTEST_API int STDCALL
2422 add_delegate (int i, int j)
2427 LIBTEST_API gpointer STDCALL
2428 mono_test_marshal_return_fnptr (void)
2430 return &add_delegate;
2433 LIBTEST_API int STDCALL
2436 printf ("codigo %x\n", code);
2444 LIBTEST_API HandleRef STDCALL
2445 mono_xr_as_handle (int code)
2449 memset (&ref, 0, sizeof (ref));
2461 LIBTEST_API int STDCALL
2462 mono_safe_handle_struct_ref (HandleStructs *x)
2464 printf ("Dingus Ref! \n");
2465 printf ("Values: %d %d %p %p\n", x->a, x->b, x->handle1, x->handle2);
2471 if (x->handle1 != (void*) 0x7080feed)
2474 if (x->handle2 != (void*) 0x1234abcd)
2480 LIBTEST_API int STDCALL
2481 mono_safe_handle_struct (HandleStructs x)
2483 printf ("Dingus Standard! \n");
2484 printf ("Values: %d %d %p %p\n", x.a, x.b, x.handle1, x.handle2);
2490 if (x.handle1 != (void*) 0x7080feed)
2493 if (x.handle2 != (void*) 0x1234abcd)
2503 LIBTEST_API int STDCALL
2504 mono_safe_handle_struct_simple (TrivialHandle x)
2506 printf ("The value is %p\n", x.a);
2507 return ((int)(gsize)x.a) * 2;
2510 LIBTEST_API int STDCALL
2511 mono_safe_handle_return (void)
2516 LIBTEST_API void STDCALL
2517 mono_safe_handle_ref (void **handle)
2520 *handle = (void *) 0xbad;
2524 *handle = (void *) 0x800d;
2527 LIBTEST_API double STDCALL
2528 mono_test_marshal_date_time (double d, double *d2)
2600 VT_USERDEFINED = 29,
2608 VT_STREAMED_OBJECT = 68,
2609 VT_STORED_OBJECT = 69,
2610 VT_BLOB_OBJECT = 70,
2618 void VariantInit(VARIANT* vt)
2635 LIBTEST_API int STDCALL
2636 mono_test_marshal_bstr_in(gunichar2* bstr)
2639 gchar* bstr_utf8 = g_utf16_to_utf8 (bstr, -1, NULL, NULL, NULL);
2640 result = strcmp("mono_test_marshal_bstr_in", bstr_utf8);
2647 LIBTEST_API int STDCALL
2648 mono_test_marshal_bstr_out(gunichar2** bstr)
2650 *bstr = marshal_bstr_alloc ("mono_test_marshal_bstr_out");
2654 LIBTEST_API int STDCALL
2655 mono_test_marshal_bstr_in_null(gunichar2* bstr)
2662 LIBTEST_API int STDCALL
2663 mono_test_marshal_bstr_out_null(gunichar2** bstr)
2669 LIBTEST_API int STDCALL
2670 mono_test_marshal_variant_in_sbyte(VARIANT variant)
2672 if (variant.vt == VT_I1 && variant.cVal == 100)
2677 LIBTEST_API int STDCALL
2678 mono_test_marshal_variant_in_byte(VARIANT variant)
2680 if (variant.vt == VT_UI1 && variant.bVal == 100)
2685 LIBTEST_API int STDCALL
2686 mono_test_marshal_variant_in_short(VARIANT variant)
2688 if (variant.vt == VT_I2 && variant.iVal == 314)
2693 LIBTEST_API int STDCALL
2694 mono_test_marshal_variant_in_ushort(VARIANT variant)
2696 if (variant.vt == VT_UI2 && variant.uiVal == 314)
2701 LIBTEST_API int STDCALL
2702 mono_test_marshal_variant_in_int(VARIANT variant)
2704 if (variant.vt == VT_I4 && variant.lVal == 314)
2709 LIBTEST_API int STDCALL
2710 mono_test_marshal_variant_in_uint(VARIANT variant)
2712 if (variant.vt == VT_UI4 && variant.ulVal == 314)
2717 LIBTEST_API int STDCALL
2718 mono_test_marshal_variant_in_long(VARIANT variant)
2720 if (variant.vt == VT_I8 && variant.llVal == 314)
2725 LIBTEST_API int STDCALL
2726 mono_test_marshal_variant_in_ulong(VARIANT variant)
2728 if (variant.vt == VT_UI8 && variant.ullVal == 314)
2733 LIBTEST_API int STDCALL
2734 mono_test_marshal_variant_in_float(VARIANT variant)
2736 if (variant.vt == VT_R4 && (variant.fltVal - 3.14)/3.14 < .001)
2741 LIBTEST_API int STDCALL
2742 mono_test_marshal_variant_in_double(VARIANT variant)
2744 if (variant.vt == VT_R8 && (variant.dblVal - 3.14)/3.14 < .001)
2749 LIBTEST_API int STDCALL
2750 mono_test_marshal_variant_in_bstr(VARIANT variant)
2753 gchar* bstr_utf8 = g_utf16_to_utf8 (variant.bstrVal, -1, NULL, NULL, NULL);
2754 result = strcmp("PI", bstr_utf8);
2757 if (variant.vt == VT_BSTR && !result)
2762 LIBTEST_API int STDCALL
2763 mono_test_marshal_variant_in_bool_true (VARIANT variant)
2765 if (variant.vt == VT_BOOL && variant.boolVal == VARIANT_TRUE)
2770 LIBTEST_API int STDCALL
2771 mono_test_marshal_variant_in_bool_false (VARIANT variant)
2773 if (variant.vt == VT_BOOL && variant.boolVal == VARIANT_FALSE)
2778 LIBTEST_API int STDCALL
2779 mono_test_marshal_variant_out_sbyte(VARIANT* variant)
2781 variant->vt = VT_I1;
2782 variant->cVal = 100;
2787 LIBTEST_API int STDCALL
2788 mono_test_marshal_variant_out_sbyte_byref(VARIANT* variant)
2790 variant->vt = VT_I1|VT_BYREF;
2791 variant->byref = marshal_alloc(1);
2792 *((gint8*)variant->byref) = 100;
2797 LIBTEST_API int STDCALL
2798 mono_test_marshal_variant_out_byte(VARIANT* variant)
2800 variant->vt = VT_UI1;
2801 variant->bVal = 100;
2806 LIBTEST_API int STDCALL
2807 mono_test_marshal_variant_out_byte_byref(VARIANT* variant)
2809 variant->vt = VT_UI1|VT_BYREF;
2810 variant->byref = marshal_alloc(1);
2811 *((gint8*)variant->byref) = 100;
2816 LIBTEST_API int STDCALL
2817 mono_test_marshal_variant_out_short(VARIANT* variant)
2819 variant->vt = VT_I2;
2820 variant->iVal = 314;
2825 LIBTEST_API int STDCALL
2826 mono_test_marshal_variant_out_short_byref(VARIANT* variant)
2828 variant->vt = VT_I2|VT_BYREF;
2829 variant->byref = marshal_alloc(2);
2830 *((gint16*)variant->byref) = 314;
2835 LIBTEST_API int STDCALL
2836 mono_test_marshal_variant_out_ushort(VARIANT* variant)
2838 variant->vt = VT_UI2;
2839 variant->uiVal = 314;
2844 LIBTEST_API int STDCALL
2845 mono_test_marshal_variant_out_ushort_byref(VARIANT* variant)
2847 variant->vt = VT_UI2|VT_BYREF;
2848 variant->byref = marshal_alloc(2);
2849 *((guint16*)variant->byref) = 314;
2854 LIBTEST_API int STDCALL
2855 mono_test_marshal_variant_out_int(VARIANT* variant)
2857 variant->vt = VT_I4;
2858 variant->lVal = 314;
2863 LIBTEST_API int STDCALL
2864 mono_test_marshal_variant_out_int_byref(VARIANT* variant)
2866 variant->vt = VT_I4|VT_BYREF;
2867 variant->byref = marshal_alloc(4);
2868 *((gint32*)variant->byref) = 314;
2873 LIBTEST_API int STDCALL
2874 mono_test_marshal_variant_out_uint(VARIANT* variant)
2876 variant->vt = VT_UI4;
2877 variant->ulVal = 314;
2882 LIBTEST_API int STDCALL
2883 mono_test_marshal_variant_out_uint_byref(VARIANT* variant)
2885 variant->vt = VT_UI4|VT_BYREF;
2886 variant->byref = marshal_alloc(4);
2887 *((guint32*)variant->byref) = 314;
2892 LIBTEST_API int STDCALL
2893 mono_test_marshal_variant_out_long(VARIANT* variant)
2895 variant->vt = VT_I8;
2896 variant->llVal = 314;
2901 LIBTEST_API int STDCALL
2902 mono_test_marshal_variant_out_long_byref(VARIANT* variant)
2904 variant->vt = VT_I8|VT_BYREF;
2905 variant->byref = marshal_alloc(8);
2906 *((gint64*)variant->byref) = 314;
2911 LIBTEST_API int STDCALL
2912 mono_test_marshal_variant_out_ulong(VARIANT* variant)
2914 variant->vt = VT_UI8;
2915 variant->ullVal = 314;
2920 LIBTEST_API int STDCALL
2921 mono_test_marshal_variant_out_ulong_byref(VARIANT* variant)
2923 variant->vt = VT_UI8|VT_BYREF;
2924 variant->byref = marshal_alloc(8);
2925 *((guint64*)variant->byref) = 314;
2930 LIBTEST_API int STDCALL
2931 mono_test_marshal_variant_out_float(VARIANT* variant)
2933 variant->vt = VT_R4;
2934 variant->fltVal = 3.14;
2939 LIBTEST_API int STDCALL
2940 mono_test_marshal_variant_out_float_byref(VARIANT* variant)
2942 variant->vt = VT_R4|VT_BYREF;
2943 variant->byref = marshal_alloc(4);
2944 *((float*)variant->byref) = 3.14;
2949 LIBTEST_API int STDCALL
2950 mono_test_marshal_variant_out_double(VARIANT* variant)
2952 variant->vt = VT_R8;
2953 variant->dblVal = 3.14;
2958 LIBTEST_API int STDCALL
2959 mono_test_marshal_variant_out_double_byref(VARIANT* variant)
2961 variant->vt = VT_R8|VT_BYREF;
2962 variant->byref = marshal_alloc(8);
2963 *((double*)variant->byref) = 3.14;
2968 LIBTEST_API int STDCALL
2969 mono_test_marshal_variant_out_bstr(VARIANT* variant)
2971 variant->vt = VT_BSTR;
2972 variant->bstrVal = marshal_bstr_alloc("PI");
2977 LIBTEST_API int STDCALL
2978 mono_test_marshal_variant_out_bstr_byref(VARIANT* variant)
2980 variant->vt = VT_BSTR|VT_BYREF;
2981 variant->byref = marshal_alloc(sizeof(gpointer));
2982 *((gunichar**)variant->byref) = (gunichar*)marshal_bstr_alloc("PI");
2987 LIBTEST_API int STDCALL
2988 mono_test_marshal_variant_out_bool_true (VARIANT* variant)
2990 variant->vt = VT_BOOL;
2991 variant->boolVal = VARIANT_TRUE;
2996 LIBTEST_API int STDCALL
2997 mono_test_marshal_variant_out_bool_true_byref (VARIANT* variant)
2999 variant->vt = VT_BOOL|VT_BYREF;
3000 variant->byref = marshal_alloc(2);
3001 *((gint16*)variant->byref) = VARIANT_TRUE;
3006 LIBTEST_API int STDCALL
3007 mono_test_marshal_variant_out_bool_false (VARIANT* variant)
3009 variant->vt = VT_BOOL;
3010 variant->boolVal = VARIANT_FALSE;
3015 LIBTEST_API int STDCALL
3016 mono_test_marshal_variant_out_bool_false_byref (VARIANT* variant)
3018 variant->vt = VT_BOOL|VT_BYREF;
3019 variant->byref = marshal_alloc(2);
3020 *((gint16*)variant->byref) = VARIANT_FALSE;
3025 typedef int (STDCALL *VarFunc) (int vt, VARIANT variant);
3026 typedef int (STDCALL *VarRefFunc) (int vt, VARIANT* variant);
3028 LIBTEST_API int STDCALL
3029 mono_test_marshal_variant_in_sbyte_unmanaged(VarFunc func)
3034 return func (VT_I1, vt);
3037 LIBTEST_API int STDCALL
3038 mono_test_marshal_variant_in_byte_unmanaged(VarFunc func)
3043 return func (VT_UI1, vt);
3046 LIBTEST_API int STDCALL
3047 mono_test_marshal_variant_in_short_unmanaged(VarFunc func)
3052 return func (VT_I2, vt);
3055 LIBTEST_API int STDCALL
3056 mono_test_marshal_variant_in_ushort_unmanaged(VarFunc func)
3061 return func (VT_UI2, vt);
3064 LIBTEST_API int STDCALL
3065 mono_test_marshal_variant_in_int_unmanaged(VarFunc func)
3070 return func (VT_I4, vt);
3073 LIBTEST_API int STDCALL
3074 mono_test_marshal_variant_in_uint_unmanaged(VarFunc func)
3079 return func (VT_UI4, vt);
3082 LIBTEST_API int STDCALL
3083 mono_test_marshal_variant_in_long_unmanaged(VarFunc func)
3088 return func (VT_I8, vt);
3091 LIBTEST_API int STDCALL
3092 mono_test_marshal_variant_in_ulong_unmanaged(VarFunc func)
3097 return func (VT_UI8, vt);
3100 LIBTEST_API int STDCALL
3101 mono_test_marshal_variant_in_float_unmanaged(VarFunc func)
3106 return func (VT_R4, vt);
3109 LIBTEST_API int STDCALL
3110 mono_test_marshal_variant_in_double_unmanaged(VarFunc func)
3115 return func (VT_R8, vt);
3118 LIBTEST_API int STDCALL
3119 mono_test_marshal_variant_in_bstr_unmanaged(VarFunc func)
3123 vt.bstrVal = marshal_bstr_alloc("PI");
3124 return func (VT_BSTR, vt);
3127 LIBTEST_API int STDCALL
3128 mono_test_marshal_variant_in_bool_true_unmanaged(VarFunc func)
3132 vt.boolVal = VARIANT_TRUE;
3133 return func (VT_BOOL, vt);
3136 LIBTEST_API int STDCALL
3137 mono_test_marshal_variant_in_bool_false_unmanaged(VarFunc func)
3141 vt.boolVal = VARIANT_FALSE;
3142 return func (VT_BOOL, vt);
3145 LIBTEST_API int STDCALL
3146 mono_test_marshal_variant_out_sbyte_unmanaged(VarRefFunc func)
3151 if (vt.vt == VT_I1 && vt.cVal == -100)
3156 LIBTEST_API int STDCALL
3157 mono_test_marshal_variant_out_byte_unmanaged(VarRefFunc func)
3162 if (vt.vt == VT_UI1 && vt.bVal == 100)
3167 LIBTEST_API int STDCALL
3168 mono_test_marshal_variant_out_short_unmanaged(VarRefFunc func)
3173 if (vt.vt == VT_I2 && vt.iVal == -100)
3178 LIBTEST_API int STDCALL
3179 mono_test_marshal_variant_out_ushort_unmanaged(VarRefFunc func)
3184 if (vt.vt == VT_UI2 && vt.uiVal == 100)
3189 LIBTEST_API int STDCALL
3190 mono_test_marshal_variant_out_int_unmanaged(VarRefFunc func)
3195 if (vt.vt == VT_I4 && vt.lVal == -100)
3200 LIBTEST_API int STDCALL
3201 mono_test_marshal_variant_out_uint_unmanaged(VarRefFunc func)
3206 if (vt.vt == VT_UI4 && vt.ulVal == 100)
3211 LIBTEST_API int STDCALL
3212 mono_test_marshal_variant_out_long_unmanaged(VarRefFunc func)
3217 if (vt.vt == VT_I8 && vt.llVal == -100)
3222 LIBTEST_API int STDCALL
3223 mono_test_marshal_variant_out_ulong_unmanaged(VarRefFunc func)
3228 if (vt.vt == VT_UI8 && vt.ullVal == 100)
3233 LIBTEST_API int STDCALL
3234 mono_test_marshal_variant_out_float_unmanaged(VarRefFunc func)
3239 if (vt.vt == VT_R4 && fabs (vt.fltVal - 3.14f) < 1e-10)
3244 LIBTEST_API int STDCALL
3245 mono_test_marshal_variant_out_double_unmanaged(VarRefFunc func)
3250 if (vt.vt == VT_R8 && fabs (vt.dblVal - 3.14) < 1e-10)
3255 LIBTEST_API int STDCALL
3256 mono_test_marshal_variant_out_bstr_unmanaged(VarRefFunc func)
3264 func (VT_BSTR, &vt);
3265 bstr_utf8 = g_utf16_to_utf8 (vt.bstrVal, -1, NULL, NULL, NULL);
3266 result = strcmp("PI", bstr_utf8);
3268 if (vt.vt == VT_BSTR && !result)
3273 LIBTEST_API int STDCALL
3274 mono_test_marshal_variant_out_bool_true_unmanaged(VarRefFunc func)
3278 func (VT_BOOL, &vt);
3279 if (vt.vt == VT_BOOL && vt.boolVal == VARIANT_TRUE)
3284 LIBTEST_API int STDCALL
3285 mono_test_marshal_variant_out_bool_false_unmanaged(VarRefFunc func)
3289 func (VT_BOOL, &vt);
3290 if (vt.vt == VT_BOOL && vt.boolVal == VARIANT_TRUE)
3295 typedef struct MonoComObject MonoComObject;
3299 int (STDCALL *QueryInterface)(MonoComObject* pUnk, gpointer riid, gpointer* ppv);
3300 int (STDCALL *AddRef)(MonoComObject* pUnk);
3301 int (STDCALL *Release)(MonoComObject* pUnk);
3302 int (STDCALL *get_ITest)(MonoComObject* pUnk, MonoComObject* *ppUnk);
3303 int (STDCALL *SByteIn)(MonoComObject* pUnk, char a);
3304 int (STDCALL *ByteIn)(MonoComObject* pUnk, unsigned char a);
3305 int (STDCALL *ShortIn)(MonoComObject* pUnk, short a);
3306 int (STDCALL *UShortIn)(MonoComObject* pUnk, unsigned short a);
3307 int (STDCALL *IntIn)(MonoComObject* pUnk, int a);
3308 int (STDCALL *UIntIn)(MonoComObject* pUnk, unsigned int a);
3309 int (STDCALL *LongIn)(MonoComObject* pUnk, gint64 a);
3310 int (STDCALL *ULongIn)(MonoComObject* pUnk, guint64 a);
3311 int (STDCALL *FloatIn)(MonoComObject* pUnk, float a);
3312 int (STDCALL *DoubleIn)(MonoComObject* pUnk, double a);
3313 int (STDCALL *ITestIn)(MonoComObject* pUnk, MonoComObject* pUnk2);
3314 int (STDCALL *ITestOut)(MonoComObject* pUnk, MonoComObject* *ppUnk);
3317 struct MonoComObject
3323 static GUID IID_ITest = {0, 0, 0, {0,0,0,0,0,0,0,1}};
3324 static GUID IID_IMonoUnknown = {0, 0, 0, {0xc0,0,0,0,0,0,0,0x46}};
3325 static GUID IID_IMonoDispatch = {0x00020400, 0, 0, {0xc0,0,0,0,0,0,0,0x46}};
3327 LIBTEST_API int STDCALL
3328 MonoQueryInterface(MonoComObject* pUnk, gpointer riid, gpointer* ppv)
3332 if (!memcmp(riid, &IID_IMonoUnknown, sizeof(GUID))) {
3336 else if (!memcmp(riid, &IID_ITest, sizeof(GUID))) {
3340 else if (!memcmp(riid, &IID_IMonoDispatch, sizeof(GUID))) {
3344 return 0x80004002; //E_NOINTERFACE;
3347 LIBTEST_API int STDCALL
3348 MonoAddRef(MonoComObject* pUnk)
3350 return ++(pUnk->m_ref);
3353 LIBTEST_API int STDCALL
3354 MonoRelease(MonoComObject* pUnk)
3356 return --(pUnk->m_ref);
3359 LIBTEST_API int STDCALL
3360 SByteIn(MonoComObject* pUnk, char a)
3365 LIBTEST_API int STDCALL
3366 ByteIn(MonoComObject* pUnk, unsigned char a)
3371 LIBTEST_API int STDCALL
3372 ShortIn(MonoComObject* pUnk, short a)
3377 LIBTEST_API int STDCALL
3378 UShortIn(MonoComObject* pUnk, unsigned short a)
3383 LIBTEST_API int STDCALL
3384 IntIn(MonoComObject* pUnk, int a)
3389 LIBTEST_API int STDCALL
3390 UIntIn(MonoComObject* pUnk, unsigned int a)
3395 LIBTEST_API int STDCALL
3396 LongIn(MonoComObject* pUnk, gint64 a)
3401 LIBTEST_API int STDCALL
3402 ULongIn(MonoComObject* pUnk, guint64 a)
3407 LIBTEST_API int STDCALL
3408 FloatIn(MonoComObject* pUnk, float a)
3413 LIBTEST_API int STDCALL
3414 DoubleIn(MonoComObject* pUnk, double a)
3419 LIBTEST_API int STDCALL
3420 ITestIn(MonoComObject* pUnk, MonoComObject *pUnk2)
3425 LIBTEST_API int STDCALL
3426 ITestOut(MonoComObject* pUnk, MonoComObject* *ppUnk)
3431 static void create_com_object (MonoComObject** pOut);
3433 LIBTEST_API int STDCALL
3434 get_ITest(MonoComObject* pUnk, MonoComObject* *ppUnk)
3436 create_com_object (ppUnk);
3440 static void create_com_object (MonoComObject** pOut)
3442 *pOut = marshal_new0 (MonoComObject, 1);
3443 (*pOut)->vtbl = marshal_new0 (MonoIUnknown, 1);
3446 (*pOut)->vtbl->QueryInterface = MonoQueryInterface;
3447 (*pOut)->vtbl->AddRef = MonoAddRef;
3448 (*pOut)->vtbl->Release = MonoRelease;
3449 (*pOut)->vtbl->SByteIn = SByteIn;
3450 (*pOut)->vtbl->ByteIn = ByteIn;
3451 (*pOut)->vtbl->ShortIn = ShortIn;
3452 (*pOut)->vtbl->UShortIn = UShortIn;
3453 (*pOut)->vtbl->IntIn = IntIn;
3454 (*pOut)->vtbl->UIntIn = UIntIn;
3455 (*pOut)->vtbl->LongIn = LongIn;
3456 (*pOut)->vtbl->ULongIn = ULongIn;
3457 (*pOut)->vtbl->FloatIn = FloatIn;
3458 (*pOut)->vtbl->DoubleIn = DoubleIn;
3459 (*pOut)->vtbl->ITestIn = ITestIn;
3460 (*pOut)->vtbl->ITestOut = ITestOut;
3461 (*pOut)->vtbl->get_ITest = get_ITest;
3464 static MonoComObject* same_object = NULL;
3466 LIBTEST_API int STDCALL
3467 mono_test_marshal_com_object_create(MonoComObject* *pUnk)
3469 create_com_object (pUnk);
3472 same_object = *pUnk;
3477 LIBTEST_API int STDCALL
3478 mono_test_marshal_com_object_same(MonoComObject* *pUnk)
3480 *pUnk = same_object;
3485 LIBTEST_API int STDCALL
3486 mono_test_marshal_com_object_destroy(MonoComObject *pUnk)
3488 int ref = --(pUnk->m_ref);
3495 LIBTEST_API int STDCALL
3496 mono_test_marshal_com_object_ref_count(MonoComObject *pUnk)
3501 LIBTEST_API int STDCALL
3502 mono_test_marshal_ccw_itest (MonoComObject *pUnk)
3505 MonoComObject* pTest;
3510 hr = pUnk->vtbl->SByteIn (pUnk, -100);
3513 hr = pUnk->vtbl->ByteIn (pUnk, 100);
3516 hr = pUnk->vtbl->ShortIn (pUnk, -100);
3519 hr = pUnk->vtbl->UShortIn (pUnk, 100);
3522 hr = pUnk->vtbl->IntIn (pUnk, -100);
3525 hr = pUnk->vtbl->UIntIn (pUnk, 100);
3528 hr = pUnk->vtbl->LongIn (pUnk, -100);
3531 hr = pUnk->vtbl->ULongIn (pUnk, 100);
3534 hr = pUnk->vtbl->FloatIn (pUnk, 3.14f);
3537 hr = pUnk->vtbl->DoubleIn (pUnk, 3.14);
3540 hr = pUnk->vtbl->ITestIn (pUnk, pUnk);
3543 hr = pUnk->vtbl->ITestOut (pUnk, &pTest);
3551 * mono_method_get_unmanaged_thunk tests
3554 #if defined(__GNUC__) && ((defined(__i386__) && (defined(__linux__) || defined (__APPLE__)) || defined (__FreeBSD__) || defined(__OpenBSD__)) || (defined(__ppc__) && defined(__APPLE__)))
3555 #define ALIGN(size) __attribute__ ((aligned(size)))
3561 /* thunks.cs:TestStruct */
3562 typedef struct _TestStruct {
3567 /* Searches for mono symbols in all loaded modules */
3569 lookup_mono_symbol (const char *symbol_name)
3572 if (g_module_symbol (g_module_open (NULL, G_MODULE_BIND_LAZY), symbol_name, &symbol))
3578 LIBTEST_API gpointer STDCALL
3579 mono_test_marshal_lookup_symbol (const char *symbol_name)
3581 return lookup_mono_symbol (symbol_name);
3584 #define MONO_BEGIN_EFRAME { void *__dummy; void *__region_cookie = mono_threads_enter_gc_unsafe_region ? mono_threads_enter_gc_unsafe_region (&__dummy) : NULL;
3585 #define MONO_END_EFRAME if (mono_threads_exit_gc_unsafe_region) mono_threads_exit_gc_unsafe_region (__region_cookie, &__dummy); }
3588 * test_method_thunk:
3590 * @test_id: the test number
3591 * @test_method_handle: MonoMethod* of the C# test method
3592 * @create_object_method_handle: MonoMethod* of thunks.cs:Test.CreateObject
3594 LIBTEST_API int STDCALL
3595 test_method_thunk (int test_id, gpointer test_method_handle, gpointer create_object_method_handle)
3599 gpointer (*mono_method_get_unmanaged_thunk)(gpointer)
3600 = (gpointer (*)(gpointer))lookup_mono_symbol ("mono_method_get_unmanaged_thunk");
3602 gpointer (*mono_string_new_wrapper)(const char *)
3603 = (gpointer (*)(const char *))lookup_mono_symbol ("mono_string_new_wrapper");
3605 char *(*mono_string_to_utf8)(gpointer)
3606 = (char *(*)(gpointer))lookup_mono_symbol ("mono_string_to_utf8");
3608 gpointer (*mono_object_unbox)(gpointer)
3609 = (gpointer (*)(gpointer))lookup_mono_symbol ("mono_object_unbox");
3611 gpointer (*mono_threads_enter_gc_unsafe_region) (gpointer)
3612 = (gpointer (*)(gpointer))lookup_mono_symbol ("mono_threads_enter_gc_unsafe_region");
3614 void (*mono_threads_exit_gc_unsafe_region) (gpointer, gpointer)
3615 = (void (*)(gpointer, gpointer))lookup_mono_symbol ("mono_threads_exit_gc_unsafe_region");
3619 gpointer test_method, ex = NULL;
3620 gpointer (STDCALL *CreateObject)(gpointer*);
3624 if (!mono_method_get_unmanaged_thunk) {
3629 test_method = mono_method_get_unmanaged_thunk (test_method_handle);
3635 CreateObject = (gpointer (STDCALL *)(gpointer *))mono_method_get_unmanaged_thunk (create_object_method_handle);
3636 if (!CreateObject) {
3645 /* thunks.cs:Test.Test0 */
3646 void (STDCALL *F)(gpointer *) = (void (STDCALL *)(gpointer *))test_method;
3652 /* thunks.cs:Test.Test1 */
3653 int (STDCALL *F)(gpointer *) = (int (STDCALL *)(gpointer *))test_method;
3654 if (F (&ex) != 42) {
3662 /* thunks.cs:Test.Test2 */
3663 gpointer (STDCALL *F)(gpointer, gpointer*) = (gpointer (STDCALL *)(gpointer, gpointer *))test_method;
3664 gpointer str = mono_string_new_wrapper ("foo");
3665 if (str != F (str, &ex)) {
3673 /* thunks.cs:Test.Test3 */
3674 gpointer (STDCALL *F)(gpointer, gpointer, gpointer*);
3678 F = (gpointer (STDCALL *)(gpointer, gpointer, gpointer *))test_method;
3679 obj = CreateObject (&ex);
3680 str = mono_string_new_wrapper ("bar");
3682 if (str != F (obj, str, &ex)) {
3690 /* thunks.cs:Test.Test4 */
3691 int (STDCALL *F)(gpointer, gpointer, int, gpointer*);
3695 F = (int (STDCALL *)(gpointer, gpointer, int, gpointer *))test_method;
3696 obj = CreateObject (&ex);
3697 str = mono_string_new_wrapper ("bar");
3699 if (42 != F (obj, str, 42, &ex)) {
3708 /* thunks.cs:Test.Test5 */
3709 int (STDCALL *F)(gpointer, gpointer, int, gpointer*);
3713 F = (int (STDCALL *)(gpointer, gpointer, int, gpointer *))test_method;
3714 obj = CreateObject (&ex);
3715 str = mono_string_new_wrapper ("bar");
3717 F (obj, str, 42, &ex);
3727 /* thunks.cs:Test.Test6 */
3728 int (STDCALL *F)(gpointer, guint8, gint16, gint32, gint64, float, double,
3729 gpointer, gpointer*);
3731 gpointer str = mono_string_new_wrapper ("Test6");
3734 F = (int (STDCALL *)(gpointer, guint8, gint16, gint32, gint64, float, double, gpointer, gpointer *))test_method;
3735 obj = CreateObject (&ex);
3737 res = F (obj, 254, 32700, -245378, 6789600, 3.1415, 3.1415, str, &ex);
3752 /* thunks.cs:Test.Test7 */
3753 gint64 (STDCALL *F)(gpointer*) = (gint64 (STDCALL *)(gpointer *))test_method;
3754 if (F (&ex) != G_MAXINT64) {
3762 /* thunks.cs:Test.Test8 */
3763 void (STDCALL *F)(guint8*, gint16*, gint32*, gint64*, float*, double*,
3764 gpointer*, gpointer*);
3774 F = (void (STDCALL *)(guint8 *, gint16 *, gint32 *, gint64 *, float *, double *,
3775 gpointer *, gpointer *))test_method;
3777 F (&a1, &a2, &a3, &a4, &a5, &a6, &a7, &ex);
3787 (fabs (a5 - 3.1415) < 0.001) &&
3788 (fabs (a6 - 3.1415) < 0.001) &&
3789 strcmp (mono_string_to_utf8 (a7), "Test8") == 0)){
3798 /* thunks.cs:Test.Test9 */
3799 void (STDCALL *F)(guint8*, gint16*, gint32*, gint64*, float*, double*,
3800 gpointer*, gpointer*);
3810 F = (void (STDCALL *)(guint8 *, gint16 *, gint32 *, gint64 *, float *, double *,
3811 gpointer *, gpointer *))test_method;
3813 F (&a1, &a2, &a3, &a4, &a5, &a6, &a7, &ex);
3823 /* thunks.cs:Test.Test10 */
3824 void (STDCALL *F)(gpointer*, gpointer*);
3826 gpointer obj1, obj2;
3828 obj1 = obj2 = CreateObject (&ex);
3834 F = (void (STDCALL *)(gpointer *, gpointer *))test_method;
3851 /* thunks.cs:TestStruct.Test0 */
3852 int (STDCALL *F)(gpointer*, gpointer*);
3858 obj = CreateObject (&ex);
3869 a1 = (TestStruct *)mono_object_unbox (obj);
3878 F = (int (STDCALL *)(gpointer *, gpointer *))test_method;
3880 res = F ((gpointer *)obj, &ex);
3891 /* check whether the call was really by value */
3892 if (a1->A != 42 || a1->B != 3.1415) {
3901 /* thunks.cs:TestStruct.Test1 */
3902 void (STDCALL *F)(gpointer, gpointer*);
3907 obj = CreateObject (&ex);
3918 a1 = (TestStruct *)mono_object_unbox (obj);
3924 F = (void (STDCALL *)(gpointer, gpointer *))test_method;
3937 if (!(fabs (a1->B - 3.1415) < 0.001)) {
3946 /* thunks.cs:TestStruct.Test2 */
3947 gpointer (STDCALL *F)(gpointer*);
3952 F = (gpointer (STDCALL *)(gpointer *))test_method;
3965 a1 = (TestStruct *)mono_object_unbox (obj);
3972 if (!(fabs (a1->B - 3.1415) < 0.001)) {
3981 /* thunks.cs:TestStruct.Test3 */
3982 void (STDCALL *F)(gpointer, gpointer*);
3987 obj = CreateObject (&ex);
3998 a1 = (TestStruct *)mono_object_unbox (obj);
4008 F = (void (STDCALL *)(gpointer, gpointer *))test_method;
4044 LIBTEST_API int STDCALL
4045 mono_test_Winx64_struct1_in (winx64_struct1 var)
4058 LIBTEST_API int STDCALL
4059 mono_test_Winx64_struct2_in (winx64_struct2 var)
4076 LIBTEST_API int STDCALL
4077 mono_test_Winx64_struct3_in (winx64_struct3 var)
4083 if (var.c != 0x1234)
4096 LIBTEST_API int STDCALL
4097 mono_test_Winx64_struct4_in (winx64_struct4 var)
4103 if (var.c != 0x1234)
4105 if (var.d != 0x87654321)
4117 LIBTEST_API int STDCALL
4118 mono_test_Winx64_struct5_in (winx64_struct5 var)
4136 LIBTEST_API int STDCALL
4137 mono_test_Winx64_struct6_in (winx64_struct6 var)
4148 LIBTEST_API int STDCALL
4149 mono_test_Winx64_structs_in1 (winx64_struct1 var1,
4150 winx64_struct2 var2,
4151 winx64_struct3 var3,
4152 winx64_struct4 var4)
4166 if (var3.c != 0x1234)
4173 if (var4.c != 0x1234)
4175 if (var4.d != 0x87654321)
4180 LIBTEST_API int STDCALL
4181 mono_test_Winx64_structs_in2 (winx64_struct1 var1,
4182 winx64_struct1 var2,
4183 winx64_struct1 var3,
4184 winx64_struct1 var4,
4185 winx64_struct1 var5)
4201 LIBTEST_API int STDCALL
4202 mono_test_Winx64_structs_in3 (winx64_struct1 var1,
4203 winx64_struct5 var2,
4204 winx64_struct1 var3,
4205 winx64_struct5 var4,
4206 winx64_struct1 var5,
4207 winx64_struct5 var6)
4242 LIBTEST_API winx64_struct1 STDCALL
4243 mono_test_Winx64_struct1_ret (void)
4250 LIBTEST_API winx64_struct2 STDCALL
4251 mono_test_Winx64_struct2_ret (void)
4259 LIBTEST_API winx64_struct3 STDCALL
4260 mono_test_Winx64_struct3_ret (void)
4269 LIBTEST_API winx64_struct4 STDCALL
4270 mono_test_Winx64_struct4_ret (void)
4280 LIBTEST_API winx64_struct5 STDCALL
4281 mono_test_Winx64_struct5_ret (void)
4290 LIBTEST_API winx64_struct1 STDCALL
4291 mono_test_Winx64_struct1_ret_5_args (char a, char b, char c, char d, char e)
4294 ret.a = a + b + c + d + e;
4298 LIBTEST_API winx64_struct5 STDCALL
4299 mono_test_Winx64_struct5_ret6_args (char a, char b, char c, char d, char e)
4312 } winx64_floatStruct;
4314 LIBTEST_API int STDCALL
4315 mono_test_Winx64_floatStruct (winx64_floatStruct a)
4317 if (a.a > 5.6 || a.a < 5.4)
4320 if (a.b > 9.6 || a.b < 9.4)
4329 } winx64_doubleStruct;
4331 LIBTEST_API int STDCALL
4332 mono_test_Winx64_doubleStruct (winx64_doubleStruct a)
4334 if (a.a > 5.6 || a.a < 5.4)
4340 typedef int (STDCALL *managed_struct1_delegate) (winx64_struct1 a);
4342 LIBTEST_API int STDCALL
4343 mono_test_managed_Winx64_struct1_in(managed_struct1_delegate func)
4350 typedef int (STDCALL *managed_struct5_delegate) (winx64_struct5 a);
4352 LIBTEST_API int STDCALL
4353 mono_test_managed_Winx64_struct5_in(managed_struct5_delegate func)
4362 typedef int (STDCALL *managed_struct1_struct5_delegate) (winx64_struct1 a, winx64_struct5 b,
4363 winx64_struct1 c, winx64_struct5 d,
4364 winx64_struct1 e, winx64_struct5 f);
4366 LIBTEST_API int STDCALL
4367 mono_test_managed_Winx64_struct1_struct5_in(managed_struct1_struct5_delegate func)
4369 winx64_struct1 a, c, e;
4370 winx64_struct5 b, d, f;
4372 b.a = 2; b.b = 3; b.c = 4;
4374 d.a = 6; d.b = 7; d.c = 8;
4376 f.a = 10; f.b = 11; f.c = 12;
4378 return func (a, b, c, d, e, f);
4381 typedef winx64_struct1 (STDCALL *managed_struct1_ret_delegate) (void);
4383 LIBTEST_API int STDCALL
4384 mono_test_Winx64_struct1_ret_managed (managed_struct1_ret_delegate func)
4396 typedef winx64_struct5 (STDCALL *managed_struct5_ret_delegate) (void);
4398 LIBTEST_API int STDCALL
4399 mono_test_Winx64_struct5_ret_managed (managed_struct5_ret_delegate func)
4415 LIBTEST_API int STDCALL
4416 mono_test_marshal_bool_in (int arg, unsigned int expected, unsigned int bDefaultMarsh, unsigned int bBoolCustMarsh,
4417 char bI1CustMarsh, unsigned char bU1CustMarsh, short bVBCustMarsh)
4421 if (bDefaultMarsh != expected)
4425 if (bBoolCustMarsh != expected)
4429 if (bI1CustMarsh != expected)
4433 if (bU1CustMarsh != expected)
4437 if (bVBCustMarsh != expected)
4446 LIBTEST_API int STDCALL
4447 mono_test_marshal_bool_out (int arg, unsigned int testVal, unsigned int* bDefaultMarsh, unsigned int* bBoolCustMarsh,
4448 char* bI1CustMarsh, unsigned char* bU1CustMarsh, unsigned short* bVBCustMarsh)
4454 *bDefaultMarsh = testVal;
4457 if (!bBoolCustMarsh)
4459 *bBoolCustMarsh = testVal;
4464 *bI1CustMarsh = (char)testVal;
4469 *bU1CustMarsh = (unsigned char)testVal;
4474 *bVBCustMarsh = (unsigned short)testVal;
4482 LIBTEST_API int STDCALL
4483 mono_test_marshal_bool_ref (int arg, unsigned int expected, unsigned int testVal, unsigned int* bDefaultMarsh,
4484 unsigned int* bBoolCustMarsh, char* bI1CustMarsh, unsigned char* bU1CustMarsh,
4485 unsigned short* bVBCustMarsh)
4491 if (*bDefaultMarsh != expected)
4493 *bDefaultMarsh = testVal;
4496 if (!bBoolCustMarsh)
4498 if (*bBoolCustMarsh != expected)
4500 *bBoolCustMarsh = testVal;
4505 if (*bI1CustMarsh != expected)
4507 *bI1CustMarsh = (char)testVal;
4512 if (*bU1CustMarsh != expected)
4514 *bU1CustMarsh = (unsigned char)testVal;
4519 if (*bVBCustMarsh != expected)
4521 *bVBCustMarsh = (unsigned short)testVal;
4530 typedef int (STDCALL *MarshalBoolInDelegate) (int arg, unsigned int expected, unsigned int bDefaultMarsh,
4531 unsigned int bBoolCustMarsh, char bI1CustMarsh, unsigned char bU1CustMarsh, unsigned short bVBCustMarsh);
4533 LIBTEST_API int STDCALL
4534 mono_test_managed_marshal_bool_in (int arg, unsigned int expected, unsigned int testVal, MarshalBoolInDelegate pfcn)
4541 return pfcn (arg, expected, testVal, 0, 0, 0, 0);
4543 return pfcn (arg, expected, 0, testVal, 0, 0, 0);
4545 return pfcn (arg, expected, 0, 0, testVal, 0, 0);
4547 return pfcn (arg, expected, 0, 0, 0, testVal, 0);
4549 return pfcn (arg, expected, 0, 0, 0, 0, testVal);
4557 typedef int (STDCALL *MarshalBoolOutDelegate) (int arg, unsigned int expected, unsigned int* bDefaultMarsh,
4558 unsigned int* bBoolCustMarsh, char* bI1CustMarsh, unsigned char* bU1CustMarsh, unsigned short* bVBCustMarsh);
4560 LIBTEST_API int STDCALL
4561 mono_test_managed_marshal_bool_out (int arg, unsigned int expected, unsigned int testVal, MarshalBoolOutDelegate pfcn)
4564 unsigned int lDefaultMarsh, lBoolCustMarsh;
4565 char lI1CustMarsh = 0;
4566 unsigned char lU1CustMarsh = 0;
4567 unsigned short lVBCustMarsh = 0;
4568 lDefaultMarsh = lBoolCustMarsh = 0;
4575 unsigned int ltVal = 0;
4576 ret = pfcn (arg, testVal, <Val, &lBoolCustMarsh, &lI1CustMarsh, &lU1CustMarsh, &lVBCustMarsh);
4578 return 0x0100 + ret;
4579 if (expected != ltVal)
4584 unsigned int ltVal = 0;
4585 ret = pfcn (arg, testVal, &lDefaultMarsh, <Val, &lI1CustMarsh, &lU1CustMarsh, &lVBCustMarsh);
4587 return 0x0300 + ret;
4588 if (expected != ltVal)
4594 ret = pfcn (arg, testVal, &lDefaultMarsh, &lBoolCustMarsh, <Val, &lU1CustMarsh, &lVBCustMarsh);
4596 return 0x0500 + ret;
4597 if (expected != ltVal)
4602 unsigned char ltVal = 0;
4603 ret = pfcn (arg, testVal, &lDefaultMarsh, &lBoolCustMarsh, &lI1CustMarsh, <Val, &lVBCustMarsh);
4605 return 0x0700 + ret;
4606 if (expected != ltVal)
4611 unsigned short ltVal = 0;
4612 ret = pfcn (arg, testVal, &lDefaultMarsh, &lBoolCustMarsh, &lI1CustMarsh, &lU1CustMarsh, <Val);
4614 return 0x0900 + ret;
4615 if (expected != ltVal)
4626 typedef int (STDCALL *MarshalBoolRefDelegate) (int arg, unsigned int expected, unsigned int testVal, unsigned int* bDefaultMarsh,
4627 unsigned int* bBoolCustMarsh, char* bI1CustMarsh, unsigned char* bU1CustMarsh, unsigned short* bVBCustMarsh);
4629 LIBTEST_API int STDCALL
4630 mono_test_managed_marshal_bool_ref (int arg, unsigned int expected, unsigned int testVal, unsigned int outExpected,
4631 unsigned int outTestVal, MarshalBoolRefDelegate pfcn)
4634 unsigned int lDefaultMarsh, lBoolCustMarsh;
4635 char lI1CustMarsh = 0;
4636 unsigned char lU1CustMarsh = 0;
4637 unsigned short lVBCustMarsh = 0;
4638 lDefaultMarsh = lBoolCustMarsh = 0;
4646 unsigned int ltestVal = testVal;
4647 ret = pfcn (arg, expected, outTestVal, <estVal, &lBoolCustMarsh, &lI1CustMarsh, &lU1CustMarsh, &lVBCustMarsh);
4649 return 0x0100 + ret;
4650 if (outExpected != ltestVal)
4656 unsigned int ltestVal = testVal;
4657 ret = pfcn (arg, expected, outTestVal, &lDefaultMarsh, <estVal, &lI1CustMarsh, &lU1CustMarsh, &lVBCustMarsh);
4659 return 0x0300 + ret;
4660 if (outExpected != ltestVal)
4666 char ltestVal = testVal;
4667 ret = pfcn (arg, expected, outTestVal, &lDefaultMarsh, &lBoolCustMarsh, <estVal, &lU1CustMarsh, &lVBCustMarsh);
4669 return 0x0500 + ret;
4670 if (outExpected != ltestVal)
4676 unsigned char ltestVal = testVal;
4677 ret = pfcn (arg, expected, outTestVal, &lDefaultMarsh, &lBoolCustMarsh, &lI1CustMarsh, <estVal, &lVBCustMarsh);
4679 return 0x0700 + ret;
4680 if (outExpected != ltestVal)
4686 unsigned short ltestVal = testVal;
4687 ret = pfcn (arg, expected, outTestVal, &lDefaultMarsh, &lBoolCustMarsh, &lI1CustMarsh, &lU1CustMarsh, <estVal);
4689 return 0x0900 + ret;
4690 if (outExpected != ltestVal)
4703 LIBTEST_API int STDCALL
4704 mono_test_marshal_safearray_out_1dim_vt_bstr_empty (SAFEARRAY** safearray)
4706 /* Create an empty one-dimensional array of variants */
4708 SAFEARRAYBOUND dimensions [1];
4710 dimensions [0].lLbound = 0;
4711 dimensions [0].cElements = 0;
4713 pSA= SafeArrayCreate (VT_VARIANT, 1, dimensions);
4718 LIBTEST_API int STDCALL
4719 mono_test_marshal_safearray_out_1dim_vt_bstr (SAFEARRAY** safearray)
4721 /* Create a one-dimensional array of 10 variants filled with "0" to "9" */
4723 SAFEARRAYBOUND dimensions [1];
4729 dimensions [0].lLbound = 0;
4730 dimensions [0].cElements = 10;
4732 pSA= SafeArrayCreate (VT_VARIANT, 1, dimensions);
4733 for (i= dimensions [0].lLbound; i< (dimensions [0].cElements + dimensions [0].lLbound); i++) {
4735 VariantInit (&vOut);
4737 _ltoa (i,buffer,10);
4738 vOut.bstrVal= marshal_bstr_alloc (buffer);
4740 if ((hr = SafeArrayPutElement (pSA, indices, &vOut)) != S_OK) {
4741 VariantClear (&vOut);
4742 SafeArrayDestroy (pSA);
4745 VariantClear (&vOut);
4751 LIBTEST_API int STDCALL
4752 mono_test_marshal_safearray_out_2dim_vt_i4 (SAFEARRAY** safearray)
4754 /* Create a two-dimensional array of 4x3 variants filled with 11, 12, 13, etc. */
4756 SAFEARRAYBOUND dimensions [2];
4761 dimensions [0].lLbound = 0;
4762 dimensions [0].cElements = 4;
4763 dimensions [1].lLbound = 0;
4764 dimensions [1].cElements = 3;
4766 pSA= SafeArrayCreate(VT_VARIANT, 2, dimensions);
4767 for (i= dimensions [0].lLbound; i< (dimensions [0].cElements + dimensions [0].lLbound); i++) {
4768 for (j= dimensions [1].lLbound; j< (dimensions [1].cElements + dimensions [1].lLbound); j++) {
4770 VariantInit (&vOut);
4772 vOut.lVal = (i+1)*10+(j+1);
4775 if ((hr = SafeArrayPutElement (pSA, indices, &vOut)) != S_OK) {
4776 VariantClear (&vOut);
4777 SafeArrayDestroy (pSA);
4780 VariantClear (&vOut); // does a deep destroy of source VARIANT
4787 LIBTEST_API int STDCALL
4788 mono_test_marshal_safearray_out_4dim_vt_i4 (SAFEARRAY** safearray)
4790 /* Create a four-dimensional array of 10x3x6x7 variants filled with their indices */
4791 /* Also use non zero lower bounds */
4793 SAFEARRAYBOUND dimensions [4];
4798 dimensions [0].lLbound = 15;
4799 dimensions [0].cElements = 10;
4800 dimensions [1].lLbound = 20;
4801 dimensions [1].cElements = 3;
4802 dimensions [2].lLbound = 5;
4803 dimensions [2].cElements = 6;
4804 dimensions [3].lLbound = 12;
4805 dimensions [3].cElements = 7;
4807 pSA= SafeArrayCreate (VT_VARIANT, 4, dimensions);
4809 SafeArrayAccessData (pSA, (void **)&pData);
4811 for (i= 0; i< 10*3*6*7; i++) {
4812 VariantInit(&pData [i]);
4813 pData [i].vt = VT_I4;
4816 SafeArrayUnaccessData (pSA);
4821 LIBTEST_API int STDCALL
4822 mono_test_marshal_safearray_in_byval_1dim_empty (SAFEARRAY* safearray)
4824 /* Check that array is one dimensional and empty */
4827 long lbound, ubound;
4829 dim = SafeArrayGetDim (safearray);
4833 SafeArrayGetLBound (safearray, 1, &lbound);
4834 SafeArrayGetUBound (safearray, 1, &ubound);
4836 if ((lbound > 0) || (ubound > 0))
4842 LIBTEST_API int STDCALL
4843 mono_test_marshal_safearray_in_byval_1dim_vt_i4 (SAFEARRAY* safearray)
4845 /* Check that array is one dimensional containing integers from 1 to 10 */
4848 long lbound, ubound;
4853 dim = SafeArrayGetDim (safearray);
4857 SafeArrayGetLBound (safearray, 1, &lbound);
4858 SafeArrayGetUBound (safearray, 1, &ubound);
4860 if ((lbound != 0) || (ubound != 9))
4863 SafeArrayAccessData (safearray, (void **)&pData);
4864 for (i= lbound; i <= ubound; i++) {
4865 if ((VariantChangeType (&pData [i], &pData [i], VARIANT_NOUSEROVERRIDE, VT_I4) != S_OK) || (pData [i].lVal != i + 1))
4868 SafeArrayUnaccessData (safearray);
4873 LIBTEST_API int STDCALL
4874 mono_test_marshal_safearray_in_byval_1dim_vt_mixed (SAFEARRAY* safearray)
4876 /* Check that array is one dimensional containing integers mixed with strings from 0 to 12 */
4879 long lbound, ubound;
4886 VariantInit (&element);
4888 dim = SafeArrayGetDim (safearray);
4892 SafeArrayGetLBound (safearray, 1, &lbound);
4893 SafeArrayGetUBound (safearray, 1, &ubound);
4895 if ((lbound != 0) || (ubound != 12))
4898 SafeArrayAccessData (safearray, (void **)&pData);
4899 for (i= lbound; i <= ubound; i++) {
4900 if ((i%2 == 0) && (pData [i].vt != VT_I4))
4902 if ((i%2 == 1) && (pData [i].vt != VT_BSTR))
4904 if ((VariantChangeType (&pData [i], &pData [i], VARIANT_NOUSEROVERRIDE, VT_I4) != S_OK) || (pData [i].lVal != i))
4907 SafeArrayUnaccessData (safearray);
4909 /* Change the first element of the array to verify that [in] parameters are not marshalled back to the managed side */
4914 SafeArrayPutElement (safearray, indices, &element);
4915 VariantClear (&element);
4920 LIBTEST_API int STDCALL
4921 mono_test_marshal_safearray_in_byval_2dim_vt_i4 (SAFEARRAY* safearray)
4923 /* Check that array is one dimensional containing integers mixed with strings from 0 to 12 */
4926 long lbound1, ubound1, lbound2, ubound2;
4931 VariantInit (&element);
4933 dim = SafeArrayGetDim (safearray);
4937 SafeArrayGetLBound (safearray, 1, &lbound1);
4938 SafeArrayGetUBound (safearray, 1, &ubound1);
4940 if ((lbound1 != 0) || (ubound1 != 1))
4943 SafeArrayGetLBound (safearray, 2, &lbound2);
4944 SafeArrayGetUBound (safearray, 2, &ubound2);
4946 if ((lbound2 != 0) || (ubound2 != 3)) {
4950 for (i= lbound1; i <= ubound1; i++) {
4952 for (j= lbound2; j <= ubound2; j++) {
4954 if (SafeArrayGetElement (safearray, indices, &element) != S_OK)
4956 failed = ((element.vt != VT_I4) || (element.lVal != 10*(i+1)+(j+1)));
4957 VariantClear (&element);
4963 /* Change the first element of the array to verify that [in] parameters are not marshalled back to the managed side */
4969 SafeArrayPutElement (safearray, indices, &element);
4970 VariantClear (&element);
4975 LIBTEST_API int STDCALL
4976 mono_test_marshal_safearray_in_byval_3dim_vt_bstr (SAFEARRAY* safearray)
4978 /* Check that array is one dimensional containing integers mixed with strings from 0 to 12 */
4981 long lbound1, ubound1, lbound2, ubound2, lbound3, ubound3;
4982 long i, j, k, failed;
4986 VariantInit (&element);
4988 dim = SafeArrayGetDim (safearray);
4992 SafeArrayGetLBound (safearray, 1, &lbound1);
4993 SafeArrayGetUBound (safearray, 1, &ubound1);
4995 if ((lbound1 != 0) || (ubound1 != 1))
4998 SafeArrayGetLBound (safearray, 2, &lbound2);
4999 SafeArrayGetUBound (safearray, 2, &ubound2);
5001 if ((lbound2 != 0) || (ubound2 != 1))
5004 SafeArrayGetLBound (safearray, 3, &lbound3);
5005 SafeArrayGetUBound (safearray, 3, &ubound3);
5007 if ((lbound3 != 0) || (ubound3 != 2))
5010 for (i= lbound1; i <= ubound1; i++) {
5012 for (j= lbound2; j <= ubound2; j++) {
5014 for (k= lbound3; k <= ubound3; k++) {
5016 if (SafeArrayGetElement (safearray, indices, &element) != S_OK)
5018 failed = ((element.vt != VT_BSTR)
5019 || (VariantChangeType (&element, &element, VARIANT_NOUSEROVERRIDE, VT_I4) != S_OK)
5020 || (element.lVal != 100*(i+1)+10*(j+1)+(k+1)));
5021 VariantClear (&element);
5028 /* Change the first element of the array to verify that [in] parameters are not marshalled back to the managed side */
5033 element.vt = VT_BSTR;
5034 element.bstrVal = SysAllocString(L"Should not be copied");
5035 SafeArrayPutElement (safearray, indices, &element);
5036 VariantClear (&element);
5041 LIBTEST_API int STDCALL
5042 mono_test_marshal_safearray_in_byref_3dim_vt_bstr (SAFEARRAY** safearray)
5044 return mono_test_marshal_safearray_in_byval_3dim_vt_bstr (*safearray);
5047 LIBTEST_API int STDCALL
5048 mono_test_marshal_safearray_in_out_byref_1dim_empty (SAFEARRAY** safearray)
5050 /* Check that the input array is what is expected and change it so the caller can check */
5051 /* correct marshalling back to managed code */
5054 long lbound, ubound;
5055 SAFEARRAYBOUND dimensions [1];
5057 wchar_t buffer [20];
5061 /* Check that in array is one dimensional and empty */
5063 dim = SafeArrayGetDim (*safearray);
5068 SafeArrayGetLBound (*safearray, 1, &lbound);
5069 SafeArrayGetUBound (*safearray, 1, &ubound);
5071 if ((lbound > 0) || (ubound > 0)) {
5075 /* Re-dimension the array and return a one-dimensional array of 8 variants filled with "0" to "7" */
5077 dimensions [0].lLbound = 0;
5078 dimensions [0].cElements = 8;
5080 hr = SafeArrayRedim (*safearray, dimensions);
5084 for (i= dimensions [0].lLbound; i< (dimensions [0].lLbound + dimensions [0].cElements); i++) {
5086 VariantInit (&vOut);
5088 _ltow (i,buffer,10);
5089 vOut.bstrVal = SysAllocString (buffer);
5091 if ((hr = SafeArrayPutElement (*safearray, indices, &vOut)) != S_OK) {
5092 VariantClear (&vOut);
5093 SafeArrayDestroy (*safearray);
5096 VariantClear (&vOut);
5101 LIBTEST_API int STDCALL
5102 mono_test_marshal_safearray_in_out_byref_3dim_vt_bstr (SAFEARRAY** safearray)
5104 /* Check that the input array is what is expected and change it so the caller can check */
5105 /* correct marshalling back to managed code */
5108 long lbound1, ubound1, lbound2, ubound2, lbound3, ubound3;
5109 SAFEARRAYBOUND dimensions [1];
5110 long i, j, k, failed;
5111 wchar_t buffer [20];
5116 VariantInit (&element);
5118 /* Check that in array is three dimensional and contains the expected values */
5120 dim = SafeArrayGetDim (*safearray);
5124 SafeArrayGetLBound (*safearray, 1, &lbound1);
5125 SafeArrayGetUBound (*safearray, 1, &ubound1);
5127 if ((lbound1 != 0) || (ubound1 != 1))
5130 SafeArrayGetLBound (*safearray, 2, &lbound2);
5131 SafeArrayGetUBound (*safearray, 2, &ubound2);
5133 if ((lbound2 != 0) || (ubound2 != 1))
5136 SafeArrayGetLBound (*safearray, 3, &lbound3);
5137 SafeArrayGetUBound (*safearray, 3, &ubound3);
5139 if ((lbound3 != 0) || (ubound3 != 2))
5142 for (i= lbound1; i <= ubound1; i++) {
5144 for (j= lbound2; j <= ubound2; j++) {
5146 for (k= lbound3; k <= ubound3; k++) {
5148 if (SafeArrayGetElement (*safearray, indices, &element) != S_OK)
5150 failed = ((element.vt != VT_BSTR)
5151 || (VariantChangeType (&element, &element, VARIANT_NOUSEROVERRIDE, VT_I4) != S_OK)
5152 || (element.lVal != 100*(i+1)+10*(j+1)+(k+1)));
5153 VariantClear (&element);
5160 hr = SafeArrayDestroy (*safearray);
5164 /* Return a new one-dimensional array of 8 variants filled with "0" to "7" */
5166 dimensions [0].lLbound = 0;
5167 dimensions [0].cElements = 8;
5169 *safearray = SafeArrayCreate (VT_VARIANT, 1, dimensions);
5171 for (i= dimensions [0].lLbound; i< (dimensions [0].lLbound + dimensions [0].cElements); i++) {
5173 VariantInit (&vOut);
5175 _ltow (i,buffer,10);
5176 vOut.bstrVal = SysAllocString (buffer);
5178 if ((hr = SafeArrayPutElement (*safearray, indices, &vOut)) != S_OK) {
5179 VariantClear (&vOut);
5180 SafeArrayDestroy (*safearray);
5183 VariantClear (&vOut);
5188 LIBTEST_API int STDCALL
5189 mono_test_marshal_safearray_in_out_byref_1dim_vt_i4 (SAFEARRAY** safearray)
5191 /* Check that the input array is what is expected and change it so the caller can check */
5192 /* correct marshalling back to managed code */
5195 long lbound1, ubound1;
5201 VariantInit (&element);
5203 /* Check that in array is one dimensional and contains the expected value */
5205 dim = SafeArrayGetDim (*safearray);
5209 SafeArrayGetLBound (*safearray, 1, &lbound1);
5210 SafeArrayGetUBound (*safearray, 1, &ubound1);
5213 if ((lbound1 != 0) || (ubound1 != 1))
5217 for (i= lbound1; i <= ubound1; i++) {
5219 if (SafeArrayGetElement (*safearray, indices, &element) != S_OK)
5221 failed = (element.vt != VT_I4) || (element.lVal != i+1);
5222 VariantClear (&element);
5227 /* Change one of the elements of the array to verify that [out] parameter is marshalled back to the managed side */
5232 SafeArrayPutElement (*safearray, indices, &element);
5233 VariantClear (&element);
5238 LIBTEST_API int STDCALL
5239 mono_test_marshal_safearray_in_out_byval_1dim_vt_i4 (SAFEARRAY* safearray)
5241 /* Check that the input array is what is expected and change it so the caller can check */
5242 /* correct marshalling back to managed code */
5245 long lbound1, ubound1;
5246 SAFEARRAYBOUND dimensions [1];
5252 VariantInit (&element);
5254 /* Check that in array is one dimensional and contains the expected value */
5256 dim = SafeArrayGetDim (safearray);
5260 SafeArrayGetLBound (safearray, 1, &lbound1);
5261 SafeArrayGetUBound (safearray, 1, &ubound1);
5263 if ((lbound1 != 0) || (ubound1 != 0))
5266 for (i= lbound1; i <= ubound1; i++) {
5268 if (SafeArrayGetElement (safearray, indices, &element) != S_OK)
5270 failed = (element.vt != VT_I4) || (element.lVal != i+1);
5271 VariantClear (&element);
5276 /* Change the array to verify how [out] parameter is marshalled back to the managed side */
5278 /* Redimension the array */
5279 dimensions [0].lLbound = lbound1;
5280 dimensions [0].cElements = 2;
5281 hr = SafeArrayRedim(safearray, dimensions);
5285 element.lVal = 12345;
5286 SafeArrayPutElement (safearray, indices, &element);
5287 VariantClear (&element);
5291 element.lVal = -12345;
5292 SafeArrayPutElement (safearray, indices, &element);
5293 VariantClear (&element);
5298 LIBTEST_API int STDCALL
5299 mono_test_marshal_safearray_in_out_byval_3dim_vt_bstr (SAFEARRAY* safearray)
5301 /* Check that the input array is what is expected and change it so the caller can check */
5302 /* correct marshalling back to managed code */
5305 long lbound1, ubound1, lbound2, ubound2, lbound3, ubound3;
5306 long i, j, k, failed;
5311 VariantInit (&element);
5313 /* Check that in array is three dimensional and contains the expected values */
5315 dim = SafeArrayGetDim (safearray);
5319 SafeArrayGetLBound (safearray, 1, &lbound1);
5320 SafeArrayGetUBound (safearray, 1, &ubound1);
5322 if ((lbound1 != 0) || (ubound1 != 1))
5325 SafeArrayGetLBound (safearray, 2, &lbound2);
5326 SafeArrayGetUBound (safearray, 2, &ubound2);
5328 if ((lbound2 != 0) || (ubound2 != 1))
5331 SafeArrayGetLBound (safearray, 3, &lbound3);
5332 SafeArrayGetUBound (safearray, 3, &ubound3);
5334 if ((lbound3 != 0) || (ubound3 != 2))
5337 for (i= lbound1; i <= ubound1; i++) {
5339 for (j= lbound2; j <= ubound2; j++) {
5341 for (k= lbound3; k <= ubound3; k++) {
5343 if (SafeArrayGetElement (safearray, indices, &element) != S_OK)
5345 failed = ((element.vt != VT_BSTR)
5346 || (VariantChangeType (&element, &element, VARIANT_NOUSEROVERRIDE, VT_I4) != S_OK)
5347 || (element.lVal != 100*(i+1)+10*(j+1)+(k+1)));
5348 VariantClear (&element);
5355 /* Change the elements of the array to verify that [out] parameter is marshalled back to the managed side */
5362 SafeArrayPutElement (safearray, indices, &element);
5363 VariantClear (&element);
5370 SafeArrayPutElement (safearray, indices, &element);
5371 VariantClear (&element);
5376 element.vt = VT_BSTR;
5377 element.bstrVal = marshal_bstr_alloc("ABCDEFG");
5378 SafeArrayPutElement (safearray, indices, &element);
5379 VariantClear (&element);
5384 LIBTEST_API int STDCALL
5385 mono_test_marshal_safearray_mixed(
5386 SAFEARRAY *safearray1,
5387 SAFEARRAY **safearray2,
5388 SAFEARRAY *safearray3,
5389 SAFEARRAY **safearray4
5394 /* Initialize out parameters */
5397 /* array1: Check that in array is one dimensional and contains the expected value */
5398 hr = mono_test_marshal_safearray_in_out_byval_1dim_vt_i4 (safearray1);
5400 /* array2: Fill in with some values to check on the managed side */
5402 hr = mono_test_marshal_safearray_out_1dim_vt_bstr (safearray2);
5404 /* array3: Check that in array is one dimensional and contains the expected value */
5406 hr = mono_test_marshal_safearray_in_byval_1dim_vt_mixed(safearray3);
5408 /* array4: Check input values and fill in with some values to check on the managed side */
5410 hr = mono_test_marshal_safearray_in_out_byref_3dim_vt_bstr(safearray4);
5417 static int call_managed_res;
5420 call_managed (gpointer arg)
5422 SimpleDelegate del = (SimpleDelegate)arg;
5424 call_managed_res = del (42);
5427 LIBTEST_API int STDCALL
5428 mono_test_marshal_thread_attach (SimpleDelegate del)
5436 res = pthread_create (&t, NULL, (gpointer (*)(gpointer))call_managed, del);
5437 g_assert (res == 0);
5438 pthread_join (t, NULL);
5440 return call_managed_res;
5444 typedef int (STDCALL *Callback) (void);
5446 static Callback callback;
5448 LIBTEST_API void STDCALL
5449 mono_test_marshal_set_callback (Callback cb)
5454 LIBTEST_API int STDCALL
5455 mono_test_marshal_call_callback (void)
5460 LIBTEST_API int STDCALL
5461 mono_test_marshal_lpstr (char *str)
5463 return strcmp ("ABC", str);
5466 LIBTEST_API int STDCALL
5467 mono_test_marshal_lpwstr (gunichar2 *str)
5472 s = g_utf16_to_utf8 (str, -1, NULL, NULL, NULL);
5473 res = strcmp ("ABC", s);
5479 LIBTEST_API char* STDCALL
5480 mono_test_marshal_return_lpstr (void)
5482 char *res = (char *)marshal_alloc (4);
5483 strcpy (res, "XYZ");
5488 LIBTEST_API gunichar2* STDCALL
5489 mono_test_marshal_return_lpwstr (void)
5491 gunichar2 *res = (gunichar2 *)marshal_alloc (8);
5492 gunichar2* tmp = g_utf8_to_utf16 ("XYZ", -1, NULL, NULL, NULL);
5494 memcpy (res, tmp, 8);
5502 } SingleDoubleStruct;
5504 LIBTEST_API SingleDoubleStruct STDCALL
5505 mono_test_marshal_return_single_double_struct (void)
5507 SingleDoubleStruct res;
5517 LIBTEST_API int STDCALL
5518 mono_test_has_thiscall (void)
5524 _mono_test_native_thiscall1 (int arg)
5530 _mono_test_native_thiscall2 (int arg, int arg2)
5532 return arg + (arg2^1);
5536 _mono_test_native_thiscall3 (int arg, int arg2, int arg3)
5538 return arg + (arg2^1) + (arg3^2);
5541 #elif defined(__GNUC__)
5543 LIBTEST_API int STDCALL
5544 mono_test_has_thiscall (void)
5549 #define def_asm_fn(name) \
5551 "\t.globl _" #name "\n" \
5553 "\t.globl __" #name "\n" \
5558 def_asm_fn(mono_test_native_thiscall1)
5559 "\tmovl %ecx,%eax\n"
5562 def_asm_fn(mono_test_native_thiscall2)
5563 "\tmovl %ecx,%eax\n"
5564 "\tmovl 4(%esp),%ecx\n"
5566 "\taddl %ecx,%eax\n"
5569 def_asm_fn(mono_test_native_thiscall3)
5570 "\tmovl %ecx,%eax\n"
5571 "\tmovl 4(%esp),%ecx\n"
5573 "\taddl %ecx,%eax\n"
5574 "\tmovl 8(%esp),%ecx\n"
5576 "\taddl %ecx,%eax\n"
5583 LIBTEST_API int STDCALL
5584 mono_test_has_thiscall (void)
5596 LIBTEST_API sbyte1 STDCALL
5597 mono_return_sbyte1 (sbyte1 s1, int addend) {
5599 fprintf(stderr, "mono_return_sbyte1 s1.f1: got %d but expected %d\n", s1.f1, 1);
5609 LIBTEST_API sbyte2 STDCALL
5610 mono_return_sbyte2 (sbyte2 s2, int addend) {
5612 fprintf(stderr, "mono_return_sbyte2 s2.f1: got %d but expected %d\n", s2.f1, 1);
5615 fprintf(stderr, "mono_return_sbyte2 s2.f2: got %d but expected %d\n", s2.f2, 2);
5617 s2.f1+=addend; s2.f2+=addend;
5625 LIBTEST_API sbyte3 STDCALL
5626 mono_return_sbyte3 (sbyte3 s3, int addend) {
5628 fprintf(stderr, "mono_return_sbyte3 s3.f1: got %d but expected %d\n", s3.f1, 1);
5631 fprintf(stderr, "mono_return_sbyte3 s3.f2: got %d but expected %d\n", s3.f2, 2);
5634 fprintf(stderr, "mono_return_sbyte3 s3.f3: got %d but expected %d\n", s3.f3, 3);
5636 s3.f1+=addend; s3.f2+=addend; s3.f3+=addend;
5644 LIBTEST_API sbyte4 STDCALL
5645 mono_return_sbyte4 (sbyte4 s4, int addend) {
5647 fprintf(stderr, "mono_return_sbyte4 s4.f1: got %d but expected %d\n", s4.f1, 1);
5650 fprintf(stderr, "mono_return_sbyte4 s4.f2: got %d but expected %d\n", s4.f2, 2);
5653 fprintf(stderr, "mono_return_sbyte4 s4.f3: got %d but expected %d\n", s4.f3, 3);
5656 fprintf(stderr, "mono_return_sbyte4 s4.f4: got %d but expected %d\n", s4.f4, 4);
5658 s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend;
5663 char f1,f2,f3,f4,f5;
5666 LIBTEST_API sbyte5 STDCALL
5667 mono_return_sbyte5 (sbyte5 s5, int addend) {
5669 fprintf(stderr, "mono_return_sbyte5 s5.f1: got %d but expected %d\n", s5.f1, 1);
5672 fprintf(stderr, "mono_return_sbyte5 s5.f2: got %d but expected %d\n", s5.f2, 2);
5675 fprintf(stderr, "mono_return_sbyte5 s5.f3: got %d but expected %d\n", s5.f3, 3);
5678 fprintf(stderr, "mono_return_sbyte5 s5.f4: got %d but expected %d\n", s5.f4, 4);
5681 fprintf(stderr, "mono_return_sbyte5 s5.f5: got %d but expected %d\n", s5.f5, 5);
5683 s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend;
5688 char f1,f2,f3,f4,f5,f6;
5691 LIBTEST_API sbyte6 STDCALL
5692 mono_return_sbyte6 (sbyte6 s6, int addend) {
5694 fprintf(stderr, "mono_return_sbyte6 s6.f1: got %d but expected %d\n", s6.f1, 1);
5697 fprintf(stderr, "mono_return_sbyte6 s6.f2: got %d but expected %d\n", s6.f2, 2);
5700 fprintf(stderr, "mono_return_sbyte6 s6.f3: got %d but expected %d\n", s6.f3, 3);
5703 fprintf(stderr, "mono_return_sbyte6 s6.f4: got %d but expected %d\n", s6.f4, 4);
5706 fprintf(stderr, "mono_return_sbyte6 s6.f5: got %d but expected %d\n", s6.f5, 5);
5709 fprintf(stderr, "mono_return_sbyte6 s6.f6: got %d but expected %d\n", s6.f6, 6);
5711 s6.f1+=addend; s6.f2+=addend; s6.f3+=addend; s6.f4+=addend; s6.f5+=addend; s6.f6+=addend;
5716 char f1,f2,f3,f4,f5,f6,f7;
5719 LIBTEST_API sbyte7 STDCALL
5720 mono_return_sbyte7 (sbyte7 s7, int addend) {
5722 fprintf(stderr, "mono_return_sbyte7 s7.f1: got %d but expected %d\n", s7.f1, 1);
5725 fprintf(stderr, "mono_return_sbyte7 s7.f2: got %d but expected %d\n", s7.f2, 2);
5728 fprintf(stderr, "mono_return_sbyte7 s7.f3: got %d but expected %d\n", s7.f3, 3);
5731 fprintf(stderr, "mono_return_sbyte7 s7.f4: got %d but expected %d\n", s7.f4, 4);
5734 fprintf(stderr, "mono_return_sbyte7 s7.f5: got %d but expected %d\n", s7.f5, 5);
5737 fprintf(stderr, "mono_return_sbyte7 s7.f6: got %d but expected %d\n", s7.f6, 6);
5740 fprintf(stderr, "mono_return_sbyte7 s7.f7: got %d but expected %d\n", s7.f7, 7);
5742 s7.f1+=addend; s7.f2+=addend; s7.f3+=addend; s7.f4+=addend; s7.f5+=addend; s7.f6+=addend; s7.f7+=addend;
5747 char f1,f2,f3,f4,f5,f6,f7,f8;
5750 LIBTEST_API sbyte8 STDCALL
5751 mono_return_sbyte8 (sbyte8 s8, int addend) {
5753 fprintf(stderr, "mono_return_sbyte8 s8.f1: got %d but expected %d\n", s8.f1, 1);
5756 fprintf(stderr, "mono_return_sbyte8 s8.f2: got %d but expected %d\n", s8.f2, 2);
5759 fprintf(stderr, "mono_return_sbyte8 s8.f3: got %d but expected %d\n", s8.f3, 3);
5762 fprintf(stderr, "mono_return_sbyte8 s8.f4: got %d but expected %d\n", s8.f4, 4);
5765 fprintf(stderr, "mono_return_sbyte8 s8.f5: got %d but expected %d\n", s8.f5, 5);
5768 fprintf(stderr, "mono_return_sbyte8 s8.f6: got %d but expected %d\n", s8.f6, 6);
5771 fprintf(stderr, "mono_return_sbyte8 s8.f7: got %d but expected %d\n", s8.f7, 7);
5774 fprintf(stderr, "mono_return_sbyte8 s8.f8: got %d but expected %d\n", s8.f8, 8);
5776 s8.f1+=addend; s8.f2+=addend; s8.f3+=addend; s8.f4+=addend; s8.f5+=addend; s8.f6+=addend; s8.f7+=addend; s8.f8+=addend;
5781 char f1,f2,f3,f4,f5,f6,f7,f8,f9;
5784 LIBTEST_API sbyte9 STDCALL
5785 mono_return_sbyte9 (sbyte9 s9, int addend) {
5787 fprintf(stderr, "mono_return_sbyte9 s9.f1: got %d but expected %d\n", s9.f1, 1);
5790 fprintf(stderr, "mono_return_sbyte9 s9.f2: got %d but expected %d\n", s9.f2, 2);
5793 fprintf(stderr, "mono_return_sbyte9 s9.f3: got %d but expected %d\n", s9.f3, 3);
5796 fprintf(stderr, "mono_return_sbyte9 s9.f4: got %d but expected %d\n", s9.f4, 4);
5799 fprintf(stderr, "mono_return_sbyte9 s9.f5: got %d but expected %d\n", s9.f5, 5);
5802 fprintf(stderr, "mono_return_sbyte9 s9.f6: got %d but expected %d\n", s9.f6, 6);
5805 fprintf(stderr, "mono_return_sbyte9 s9.f7: got %d but expected %d\n", s9.f7, 7);
5808 fprintf(stderr, "mono_return_sbyte9 s9.f8: got %d but expected %d\n", s9.f8, 8);
5811 fprintf(stderr, "mono_return_sbyte9 s9.f9: got %d but expected %d\n", s9.f9, 9);
5813 s9.f1+=addend; s9.f2+=addend; s9.f3+=addend; s9.f4+=addend; s9.f5+=addend; s9.f6+=addend; s9.f7+=addend; s9.f8+=addend; s9.f9+=addend;
5818 char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10;
5821 LIBTEST_API sbyte10 STDCALL
5822 mono_return_sbyte10 (sbyte10 s10, int addend) {
5824 fprintf(stderr, "mono_return_sbyte10 s10.f1: got %d but expected %d\n", s10.f1, 1);
5827 fprintf(stderr, "mono_return_sbyte10 s10.f2: got %d but expected %d\n", s10.f2, 2);
5830 fprintf(stderr, "mono_return_sbyte10 s10.f3: got %d but expected %d\n", s10.f3, 3);
5833 fprintf(stderr, "mono_return_sbyte10 s10.f4: got %d but expected %d\n", s10.f4, 4);
5836 fprintf(stderr, "mono_return_sbyte10 s10.f5: got %d but expected %d\n", s10.f5, 5);
5839 fprintf(stderr, "mono_return_sbyte10 s10.f6: got %d but expected %d\n", s10.f6, 6);
5842 fprintf(stderr, "mono_return_sbyte10 s10.f7: got %d but expected %d\n", s10.f7, 7);
5845 fprintf(stderr, "mono_return_sbyte10 s10.f8: got %d but expected %d\n", s10.f8, 8);
5848 fprintf(stderr, "mono_return_sbyte10 s10.f9: got %d but expected %d\n", s10.f9, 9);
5850 if (s10.f10 != 10) {
5851 fprintf(stderr, "mono_return_sbyte10 s10.f10: got %d but expected %d\n", s10.f10, 10);
5853 s10.f1+=addend; s10.f2+=addend; s10.f3+=addend; s10.f4+=addend; s10.f5+=addend; s10.f6+=addend; s10.f7+=addend; s10.f8+=addend; s10.f9+=addend; s10.f10+=addend;
5858 char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11;
5861 LIBTEST_API sbyte11 STDCALL
5862 mono_return_sbyte11 (sbyte11 s11, int addend) {
5864 fprintf(stderr, "mono_return_sbyte11 s11.f1: got %d but expected %d\n", s11.f1, 1);
5867 fprintf(stderr, "mono_return_sbyte11 s11.f2: got %d but expected %d\n", s11.f2, 2);
5870 fprintf(stderr, "mono_return_sbyte11 s11.f3: got %d but expected %d\n", s11.f3, 3);
5873 fprintf(stderr, "mono_return_sbyte11 s11.f4: got %d but expected %d\n", s11.f4, 4);
5876 fprintf(stderr, "mono_return_sbyte11 s11.f5: got %d but expected %d\n", s11.f5, 5);
5879 fprintf(stderr, "mono_return_sbyte11 s11.f6: got %d but expected %d\n", s11.f6, 6);
5882 fprintf(stderr, "mono_return_sbyte11 s11.f7: got %d but expected %d\n", s11.f7, 7);
5885 fprintf(stderr, "mono_return_sbyte11 s11.f8: got %d but expected %d\n", s11.f8, 8);
5888 fprintf(stderr, "mono_return_sbyte11 s11.f9: got %d but expected %d\n", s11.f9, 9);
5890 if (s11.f10 != 10) {
5891 fprintf(stderr, "mono_return_sbyte11 s11.f10: got %d but expected %d\n", s11.f10, 10);
5893 if (s11.f11 != 11) {
5894 fprintf(stderr, "mono_return_sbyte11 s11.f11: got %d but expected %d\n", s11.f11, 11);
5896 s11.f1+=addend; s11.f2+=addend; s11.f3+=addend; s11.f4+=addend; s11.f5+=addend; s11.f6+=addend; s11.f7+=addend; s11.f8+=addend; s11.f9+=addend; s11.f10+=addend; s11.f11+=addend;
5901 char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12;
5904 LIBTEST_API sbyte12 STDCALL
5905 mono_return_sbyte12 (sbyte12 s12, int addend) {
5907 fprintf(stderr, "mono_return_sbyte12 s12.f1: got %d but expected %d\n", s12.f1, 1);
5910 fprintf(stderr, "mono_return_sbyte12 s12.f2: got %d but expected %d\n", s12.f2, 2);
5913 fprintf(stderr, "mono_return_sbyte12 s12.f3: got %d but expected %d\n", s12.f3, 3);
5916 fprintf(stderr, "mono_return_sbyte12 s12.f4: got %d but expected %d\n", s12.f4, 4);
5919 fprintf(stderr, "mono_return_sbyte12 s12.f5: got %d but expected %d\n", s12.f5, 5);
5922 fprintf(stderr, "mono_return_sbyte12 s12.f6: got %d but expected %d\n", s12.f6, 6);
5925 fprintf(stderr, "mono_return_sbyte12 s12.f7: got %d but expected %d\n", s12.f7, 7);
5928 fprintf(stderr, "mono_return_sbyte12 s12.f8: got %d but expected %d\n", s12.f8, 8);
5931 fprintf(stderr, "mono_return_sbyte12 s12.f9: got %d but expected %d\n", s12.f9, 9);
5933 if (s12.f10 != 10) {
5934 fprintf(stderr, "mono_return_sbyte12 s12.f10: got %d but expected %d\n", s12.f10, 10);
5936 if (s12.f11 != 11) {
5937 fprintf(stderr, "mono_return_sbyte12 s12.f11: got %d but expected %d\n", s12.f11, 11);
5939 if (s12.f12 != 12) {
5940 fprintf(stderr, "mono_return_sbyte12 s12.f12: got %d but expected %d\n", s12.f12, 12);
5942 s12.f1+=addend; s12.f2+=addend; s12.f3+=addend; s12.f4+=addend; s12.f5+=addend; s12.f6+=addend; s12.f7+=addend; s12.f8+=addend; s12.f9+=addend; s12.f10+=addend; s12.f11+=addend; s12.f12+=addend;
5947 char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13;
5950 LIBTEST_API sbyte13 STDCALL
5951 mono_return_sbyte13 (sbyte13 s13, int addend) {
5953 fprintf(stderr, "mono_return_sbyte13 s13.f1: got %d but expected %d\n", s13.f1, 1);
5956 fprintf(stderr, "mono_return_sbyte13 s13.f2: got %d but expected %d\n", s13.f2, 2);
5959 fprintf(stderr, "mono_return_sbyte13 s13.f3: got %d but expected %d\n", s13.f3, 3);
5962 fprintf(stderr, "mono_return_sbyte13 s13.f4: got %d but expected %d\n", s13.f4, 4);
5965 fprintf(stderr, "mono_return_sbyte13 s13.f5: got %d but expected %d\n", s13.f5, 5);
5968 fprintf(stderr, "mono_return_sbyte13 s13.f6: got %d but expected %d\n", s13.f6, 6);
5971 fprintf(stderr, "mono_return_sbyte13 s13.f7: got %d but expected %d\n", s13.f7, 7);
5974 fprintf(stderr, "mono_return_sbyte13 s13.f8: got %d but expected %d\n", s13.f8, 8);
5977 fprintf(stderr, "mono_return_sbyte13 s13.f9: got %d but expected %d\n", s13.f9, 9);
5979 if (s13.f10 != 10) {
5980 fprintf(stderr, "mono_return_sbyte13 s13.f10: got %d but expected %d\n", s13.f10, 10);
5982 if (s13.f11 != 11) {
5983 fprintf(stderr, "mono_return_sbyte13 s13.f11: got %d but expected %d\n", s13.f11, 11);
5985 if (s13.f12 != 12) {
5986 fprintf(stderr, "mono_return_sbyte13 s13.f12: got %d but expected %d\n", s13.f12, 12);
5988 if (s13.f13 != 13) {
5989 fprintf(stderr, "mono_return_sbyte13 s13.f13: got %d but expected %d\n", s13.f13, 13);
5991 s13.f1+=addend; s13.f2+=addend; s13.f3+=addend; s13.f4+=addend; s13.f5+=addend; s13.f6+=addend; s13.f7+=addend; s13.f8+=addend; s13.f9+=addend; s13.f10+=addend; s13.f11+=addend; s13.f12+=addend; s13.f13+=addend;
5996 char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14;
5999 LIBTEST_API sbyte14 STDCALL
6000 mono_return_sbyte14 (sbyte14 s14, int addend) {
6002 fprintf(stderr, "mono_return_sbyte14 s14.f1: got %d but expected %d\n", s14.f1, 1);
6005 fprintf(stderr, "mono_return_sbyte14 s14.f2: got %d but expected %d\n", s14.f2, 2);
6008 fprintf(stderr, "mono_return_sbyte14 s14.f3: got %d but expected %d\n", s14.f3, 3);
6011 fprintf(stderr, "mono_return_sbyte14 s14.f4: got %d but expected %d\n", s14.f4, 4);
6014 fprintf(stderr, "mono_return_sbyte14 s14.f5: got %d but expected %d\n", s14.f5, 5);
6017 fprintf(stderr, "mono_return_sbyte14 s14.f6: got %d but expected %d\n", s14.f6, 6);
6020 fprintf(stderr, "mono_return_sbyte14 s14.f7: got %d but expected %d\n", s14.f7, 7);
6023 fprintf(stderr, "mono_return_sbyte14 s14.f8: got %d but expected %d\n", s14.f8, 8);
6026 fprintf(stderr, "mono_return_sbyte14 s14.f9: got %d but expected %d\n", s14.f9, 9);
6028 if (s14.f10 != 10) {
6029 fprintf(stderr, "mono_return_sbyte14 s14.f10: got %d but expected %d\n", s14.f10, 10);
6031 if (s14.f11 != 11) {
6032 fprintf(stderr, "mono_return_sbyte14 s14.f11: got %d but expected %d\n", s14.f11, 11);
6034 if (s14.f12 != 12) {
6035 fprintf(stderr, "mono_return_sbyte14 s14.f12: got %d but expected %d\n", s14.f12, 12);
6037 if (s14.f13 != 13) {
6038 fprintf(stderr, "mono_return_sbyte14 s14.f13: got %d but expected %d\n", s14.f13, 13);
6040 if (s14.f14 != 14) {
6041 fprintf(stderr, "mono_return_sbyte14 s14.f14: got %d but expected %d\n", s14.f14, 14);
6043 s14.f1+=addend; s14.f2+=addend; s14.f3+=addend; s14.f4+=addend; s14.f5+=addend; s14.f6+=addend; s14.f7+=addend; s14.f8+=addend; s14.f9+=addend; s14.f10+=addend; s14.f11+=addend; s14.f12+=addend; s14.f13+=addend; s14.f14+=addend;
6048 char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15;
6051 LIBTEST_API sbyte15 STDCALL
6052 mono_return_sbyte15 (sbyte15 s15, int addend) {
6054 fprintf(stderr, "mono_return_sbyte15 s15.f1: got %d but expected %d\n", s15.f1, 1);
6057 fprintf(stderr, "mono_return_sbyte15 s15.f2: got %d but expected %d\n", s15.f2, 2);
6060 fprintf(stderr, "mono_return_sbyte15 s15.f3: got %d but expected %d\n", s15.f3, 3);
6063 fprintf(stderr, "mono_return_sbyte15 s15.f4: got %d but expected %d\n", s15.f4, 4);
6066 fprintf(stderr, "mono_return_sbyte15 s15.f5: got %d but expected %d\n", s15.f5, 5);
6069 fprintf(stderr, "mono_return_sbyte15 s15.f6: got %d but expected %d\n", s15.f6, 6);
6072 fprintf(stderr, "mono_return_sbyte15 s15.f7: got %d but expected %d\n", s15.f7, 7);
6075 fprintf(stderr, "mono_return_sbyte15 s15.f8: got %d but expected %d\n", s15.f8, 8);
6078 fprintf(stderr, "mono_return_sbyte15 s15.f9: got %d but expected %d\n", s15.f9, 9);
6080 if (s15.f10 != 10) {
6081 fprintf(stderr, "mono_return_sbyte15 s15.f10: got %d but expected %d\n", s15.f10, 10);
6083 if (s15.f11 != 11) {
6084 fprintf(stderr, "mono_return_sbyte15 s15.f11: got %d but expected %d\n", s15.f11, 11);
6086 if (s15.f12 != 12) {
6087 fprintf(stderr, "mono_return_sbyte15 s15.f12: got %d but expected %d\n", s15.f12, 12);
6089 if (s15.f13 != 13) {
6090 fprintf(stderr, "mono_return_sbyte15 s15.f13: got %d but expected %d\n", s15.f13, 13);
6092 if (s15.f14 != 14) {
6093 fprintf(stderr, "mono_return_sbyte15 s15.f14: got %d but expected %d\n", s15.f14, 14);
6095 if (s15.f15 != 15) {
6096 fprintf(stderr, "mono_return_sbyte15 s15.f15: got %d but expected %d\n", s15.f15, 15);
6098 s15.f1+=addend; s15.f2+=addend; s15.f3+=addend; s15.f4+=addend; s15.f5+=addend; s15.f6+=addend; s15.f7+=addend; s15.f8+=addend; s15.f9+=addend; s15.f10+=addend; s15.f11+=addend; s15.f12+=addend; s15.f13+=addend; s15.f14+=addend; s15.f15+=addend;
6103 char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16;
6106 LIBTEST_API sbyte16 STDCALL
6107 mono_return_sbyte16 (sbyte16 s16, int addend) {
6109 fprintf(stderr, "mono_return_sbyte16 s16.f1: got %d but expected %d\n", s16.f1, 1);
6112 fprintf(stderr, "mono_return_sbyte16 s16.f2: got %d but expected %d\n", s16.f2, 2);
6115 fprintf(stderr, "mono_return_sbyte16 s16.f3: got %d but expected %d\n", s16.f3, 3);
6118 fprintf(stderr, "mono_return_sbyte16 s16.f4: got %d but expected %d\n", s16.f4, 4);
6121 fprintf(stderr, "mono_return_sbyte16 s16.f5: got %d but expected %d\n", s16.f5, 5);
6124 fprintf(stderr, "mono_return_sbyte16 s16.f6: got %d but expected %d\n", s16.f6, 6);
6127 fprintf(stderr, "mono_return_sbyte16 s16.f7: got %d but expected %d\n", s16.f7, 7);
6130 fprintf(stderr, "mono_return_sbyte16 s16.f8: got %d but expected %d\n", s16.f8, 8);
6133 fprintf(stderr, "mono_return_sbyte16 s16.f9: got %d but expected %d\n", s16.f9, 9);
6135 if (s16.f10 != 10) {
6136 fprintf(stderr, "mono_return_sbyte16 s16.f10: got %d but expected %d\n", s16.f10, 10);
6138 if (s16.f11 != 11) {
6139 fprintf(stderr, "mono_return_sbyte16 s16.f11: got %d but expected %d\n", s16.f11, 11);
6141 if (s16.f12 != 12) {
6142 fprintf(stderr, "mono_return_sbyte16 s16.f12: got %d but expected %d\n", s16.f12, 12);
6144 if (s16.f13 != 13) {
6145 fprintf(stderr, "mono_return_sbyte16 s16.f13: got %d but expected %d\n", s16.f13, 13);
6147 if (s16.f14 != 14) {
6148 fprintf(stderr, "mono_return_sbyte16 s16.f14: got %d but expected %d\n", s16.f14, 14);
6150 if (s16.f15 != 15) {
6151 fprintf(stderr, "mono_return_sbyte16 s16.f15: got %d but expected %d\n", s16.f15, 15);
6153 if (s16.f16 != 16) {
6154 fprintf(stderr, "mono_return_sbyte16 s16.f16: got %d but expected %d\n", s16.f16, 16);
6156 s16.f1+=addend; s16.f2+=addend; s16.f3+=addend; s16.f4+=addend; s16.f5+=addend; s16.f6+=addend; s16.f7+=addend; s16.f8+=addend; s16.f9+=addend; s16.f10+=addend; s16.f11+=addend; s16.f12+=addend; s16.f13+=addend; s16.f14+=addend; s16.f15+=addend; s16.f16+=addend;
6161 char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17;
6164 LIBTEST_API sbyte17 STDCALL
6165 mono_return_sbyte17 (sbyte17 s17, int addend) {
6167 fprintf(stderr, "mono_return_sbyte17 s17.f1: got %d but expected %d\n", s17.f1, 1);
6170 fprintf(stderr, "mono_return_sbyte17 s17.f2: got %d but expected %d\n", s17.f2, 2);
6173 fprintf(stderr, "mono_return_sbyte17 s17.f3: got %d but expected %d\n", s17.f3, 3);
6176 fprintf(stderr, "mono_return_sbyte17 s17.f4: got %d but expected %d\n", s17.f4, 4);
6179 fprintf(stderr, "mono_return_sbyte17 s17.f5: got %d but expected %d\n", s17.f5, 5);
6182 fprintf(stderr, "mono_return_sbyte17 s17.f6: got %d but expected %d\n", s17.f6, 6);
6185 fprintf(stderr, "mono_return_sbyte17 s17.f7: got %d but expected %d\n", s17.f7, 7);
6188 fprintf(stderr, "mono_return_sbyte17 s17.f8: got %d but expected %d\n", s17.f8, 8);
6191 fprintf(stderr, "mono_return_sbyte17 s17.f9: got %d but expected %d\n", s17.f9, 9);
6193 if (s17.f10 != 10) {
6194 fprintf(stderr, "mono_return_sbyte17 s17.f10: got %d but expected %d\n", s17.f10, 10);
6196 if (s17.f11 != 11) {
6197 fprintf(stderr, "mono_return_sbyte17 s17.f11: got %d but expected %d\n", s17.f11, 11);
6199 if (s17.f12 != 12) {
6200 fprintf(stderr, "mono_return_sbyte17 s17.f12: got %d but expected %d\n", s17.f12, 12);
6202 if (s17.f13 != 13) {
6203 fprintf(stderr, "mono_return_sbyte17 s17.f13: got %d but expected %d\n", s17.f13, 13);
6205 if (s17.f14 != 14) {
6206 fprintf(stderr, "mono_return_sbyte17 s17.f14: got %d but expected %d\n", s17.f14, 14);
6208 if (s17.f15 != 15) {
6209 fprintf(stderr, "mono_return_sbyte17 s17.f15: got %d but expected %d\n", s17.f15, 15);
6211 if (s17.f16 != 16) {
6212 fprintf(stderr, "mono_return_sbyte17 s17.f16: got %d but expected %d\n", s17.f16, 16);
6214 if (s17.f17 != 17) {
6215 fprintf(stderr, "mono_return_sbyte17 s17.f17: got %d but expected %d\n", s17.f17, 17);
6217 s17.f1+=addend; s17.f2+=addend; s17.f3+=addend; s17.f4+=addend; s17.f5+=addend; s17.f6+=addend; s17.f7+=addend; s17.f8+=addend; s17.f9+=addend; s17.f10+=addend; s17.f11+=addend; s17.f12+=addend; s17.f13+=addend; s17.f14+=addend; s17.f15+=addend; s17.f16+=addend; s17.f17+=addend;
6225 char f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15;
6231 LIBTEST_API sbyte16_nested STDCALL
6232 mono_return_sbyte16_nested (sbyte16_nested sn16, int addend) {
6233 if (sn16.nested1.f1 != 1) {
6234 fprintf(stderr, "mono_return_sbyte16_nested sn16.nested1.f1: got %d but expected %d\n", sn16.nested1.f1, 1);
6237 fprintf(stderr, "mono_return_sbyte16_nested sn16.f2: got %d but expected %d\n", sn16.f2, 2);
6240 fprintf(stderr, "mono_return_sbyte16_nested sn16.f3: got %d but expected %d\n", sn16.f3, 3);
6243 fprintf(stderr, "mono_return_sbyte16_nested sn16.f4: got %d but expected %d\n", sn16.f4, 4);
6246 fprintf(stderr, "mono_return_sbyte16_nested sn16.f5: got %d but expected %d\n", sn16.f5, 5);
6249 fprintf(stderr, "mono_return_sbyte16_nested sn16.f6: got %d but expected %d\n", sn16.f6, 6);
6252 fprintf(stderr, "mono_return_sbyte16_nested sn16.f7: got %d but expected %d\n", sn16.f7, 7);
6255 fprintf(stderr, "mono_return_sbyte16_nested sn16.f8: got %d but expected %d\n", sn16.f8, 8);
6258 fprintf(stderr, "mono_return_sbyte16_nested sn16.f9: got %d but expected %d\n", sn16.f9, 9);
6260 if (sn16.f10 != 10) {
6261 fprintf(stderr, "mono_return_sbyte16_nested sn16.f10: got %d but expected %d\n", sn16.f10, 10);
6263 if (sn16.f11 != 11) {
6264 fprintf(stderr, "mono_return_sbyte16_nested sn16.f11: got %d but expected %d\n", sn16.f11, 11);
6266 if (sn16.f12 != 12) {
6267 fprintf(stderr, "mono_return_sbyte16_nested sn16.f12: got %d but expected %d\n", sn16.f12, 12);
6269 if (sn16.f13 != 13) {
6270 fprintf(stderr, "mono_return_sbyte16_nested sn16.f13: got %d but expected %d\n", sn16.f13, 13);
6272 if (sn16.f14 != 14) {
6273 fprintf(stderr, "mono_return_sbyte16_nested sn16.f14: got %d but expected %d\n", sn16.f14, 14);
6275 if (sn16.f15 != 15) {
6276 fprintf(stderr, "mono_return_sbyte16_nested sn16.f15: got %d but expected %d\n", sn16.f15, 15);
6278 if (sn16.nested2.f16 != 16) {
6279 fprintf(stderr, "mono_return_sbyte16_nested sn16.nested2.f16: got %d but expected %d\n", sn16.nested2.f16, 16);
6281 sn16.nested1.f1+=addend; sn16.f2+=addend; sn16.f3+=addend; sn16.f4+=addend; sn16.f5+=addend; sn16.f6+=addend; sn16.f7+=addend; sn16.f8+=addend; sn16.f9+=addend; sn16.f10+=addend; sn16.f11+=addend; sn16.f12+=addend; sn16.f13+=addend; sn16.f14+=addend; sn16.f15+=addend; sn16.nested2.f16+=addend;
6290 LIBTEST_API short1 STDCALL
6291 mono_return_short1 (short1 s1, int addend) {
6293 fprintf(stderr, "mono_return_short1 s1.f1: got %d but expected %d\n", s1.f1, 1);
6303 LIBTEST_API short2 STDCALL
6304 mono_return_short2 (short2 s2, int addend) {
6306 fprintf(stderr, "mono_return_short2 s2.f1: got %d but expected %d\n", s2.f1, 1);
6309 fprintf(stderr, "mono_return_short2 s2.f2: got %d but expected %d\n", s2.f2, 2);
6311 s2.f1+=addend; s2.f2+=addend;
6319 LIBTEST_API short3 STDCALL
6320 mono_return_short3 (short3 s3, int addend) {
6322 fprintf(stderr, "mono_return_short3 s3.f1: got %d but expected %d\n", s3.f1, 1);
6325 fprintf(stderr, "mono_return_short3 s3.f2: got %d but expected %d\n", s3.f2, 2);
6328 fprintf(stderr, "mono_return_short3 s3.f3: got %d but expected %d\n", s3.f3, 3);
6330 s3.f1+=addend; s3.f2+=addend; s3.f3+=addend;
6338 LIBTEST_API short4 STDCALL
6339 mono_return_short4 (short4 s4, int addend) {
6341 fprintf(stderr, "mono_return_short4 s4.f1: got %d but expected %d\n", s4.f1, 1);
6344 fprintf(stderr, "mono_return_short4 s4.f2: got %d but expected %d\n", s4.f2, 2);
6347 fprintf(stderr, "mono_return_short4 s4.f3: got %d but expected %d\n", s4.f3, 3);
6350 fprintf(stderr, "mono_return_short4 s4.f4: got %d but expected %d\n", s4.f4, 4);
6352 s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend;
6357 short f1,f2,f3,f4,f5;
6360 LIBTEST_API short5 STDCALL
6361 mono_return_short5 (short5 s5, int addend) {
6363 fprintf(stderr, "mono_return_short5 s5.f1: got %d but expected %d\n", s5.f1, 1);
6366 fprintf(stderr, "mono_return_short5 s5.f2: got %d but expected %d\n", s5.f2, 2);
6369 fprintf(stderr, "mono_return_short5 s5.f3: got %d but expected %d\n", s5.f3, 3);
6372 fprintf(stderr, "mono_return_short5 s5.f4: got %d but expected %d\n", s5.f4, 4);
6375 fprintf(stderr, "mono_return_short5 s5.f5: got %d but expected %d\n", s5.f5, 5);
6377 s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend;
6382 short f1,f2,f3,f4,f5,f6;
6385 LIBTEST_API short6 STDCALL
6386 mono_return_short6 (short6 s6, int addend) {
6388 fprintf(stderr, "mono_return_short6 s6.f1: got %d but expected %d\n", s6.f1, 1);
6391 fprintf(stderr, "mono_return_short6 s6.f2: got %d but expected %d\n", s6.f2, 2);
6394 fprintf(stderr, "mono_return_short6 s6.f3: got %d but expected %d\n", s6.f3, 3);
6397 fprintf(stderr, "mono_return_short6 s6.f4: got %d but expected %d\n", s6.f4, 4);
6400 fprintf(stderr, "mono_return_short6 s6.f5: got %d but expected %d\n", s6.f5, 5);
6403 fprintf(stderr, "mono_return_short6 s6.f6: got %d but expected %d\n", s6.f6, 6);
6405 s6.f1+=addend; s6.f2+=addend; s6.f3+=addend; s6.f4+=addend; s6.f5+=addend; s6.f6+=addend;
6410 short f1,f2,f3,f4,f5,f6,f7;
6413 LIBTEST_API short7 STDCALL
6414 mono_return_short7 (short7 s7, int addend) {
6416 fprintf(stderr, "mono_return_short7 s7.f1: got %d but expected %d\n", s7.f1, 1);
6419 fprintf(stderr, "mono_return_short7 s7.f2: got %d but expected %d\n", s7.f2, 2);
6422 fprintf(stderr, "mono_return_short7 s7.f3: got %d but expected %d\n", s7.f3, 3);
6425 fprintf(stderr, "mono_return_short7 s7.f4: got %d but expected %d\n", s7.f4, 4);
6428 fprintf(stderr, "mono_return_short7 s7.f5: got %d but expected %d\n", s7.f5, 5);
6431 fprintf(stderr, "mono_return_short7 s7.f6: got %d but expected %d\n", s7.f6, 6);
6434 fprintf(stderr, "mono_return_short7 s7.f7: got %d but expected %d\n", s7.f7, 7);
6436 s7.f1+=addend; s7.f2+=addend; s7.f3+=addend; s7.f4+=addend; s7.f5+=addend; s7.f6+=addend; s7.f7+=addend;
6441 short f1,f2,f3,f4,f5,f6,f7,f8;
6444 LIBTEST_API short8 STDCALL
6445 mono_return_short8 (short8 s8, int addend) {
6447 fprintf(stderr, "mono_return_short8 s8.f1: got %d but expected %d\n", s8.f1, 1);
6450 fprintf(stderr, "mono_return_short8 s8.f2: got %d but expected %d\n", s8.f2, 2);
6453 fprintf(stderr, "mono_return_short8 s8.f3: got %d but expected %d\n", s8.f3, 3);
6456 fprintf(stderr, "mono_return_short8 s8.f4: got %d but expected %d\n", s8.f4, 4);
6459 fprintf(stderr, "mono_return_short8 s8.f5: got %d but expected %d\n", s8.f5, 5);
6462 fprintf(stderr, "mono_return_short8 s8.f6: got %d but expected %d\n", s8.f6, 6);
6465 fprintf(stderr, "mono_return_short8 s8.f7: got %d but expected %d\n", s8.f7, 7);
6468 fprintf(stderr, "mono_return_short8 s8.f8: got %d but expected %d\n", s8.f8, 8);
6470 s8.f1+=addend; s8.f2+=addend; s8.f3+=addend; s8.f4+=addend; s8.f5+=addend; s8.f6+=addend; s8.f7+=addend; s8.f8+=addend;
6475 short f1,f2,f3,f4,f5,f6,f7,f8,f9;
6478 LIBTEST_API short9 STDCALL
6479 mono_return_short9 (short9 s9, int addend) {
6481 fprintf(stderr, "mono_return_short9 s9.f1: got %d but expected %d\n", s9.f1, 1);
6484 fprintf(stderr, "mono_return_short9 s9.f2: got %d but expected %d\n", s9.f2, 2);
6487 fprintf(stderr, "mono_return_short9 s9.f3: got %d but expected %d\n", s9.f3, 3);
6490 fprintf(stderr, "mono_return_short9 s9.f4: got %d but expected %d\n", s9.f4, 4);
6493 fprintf(stderr, "mono_return_short9 s9.f5: got %d but expected %d\n", s9.f5, 5);
6496 fprintf(stderr, "mono_return_short9 s9.f6: got %d but expected %d\n", s9.f6, 6);
6499 fprintf(stderr, "mono_return_short9 s9.f7: got %d but expected %d\n", s9.f7, 7);
6502 fprintf(stderr, "mono_return_short9 s9.f8: got %d but expected %d\n", s9.f8, 8);
6505 fprintf(stderr, "mono_return_short9 s9.f9: got %d but expected %d\n", s9.f9, 9);
6507 s9.f1+=addend; s9.f2+=addend; s9.f3+=addend; s9.f4+=addend; s9.f5+=addend; s9.f6+=addend; s9.f7+=addend; s9.f8+=addend; s9.f9+=addend;
6515 short f2,f3,f4,f5,f6,f7;
6521 LIBTEST_API short8_nested STDCALL
6522 mono_return_short8_nested (short8_nested sn8, int addend) {
6523 if (sn8.nested1.f1 != 1) {
6524 fprintf(stderr, "mono_return_short8_nested sn8.nested1.f1: got %d but expected %d\n", sn8.nested1.f1, 1);
6527 fprintf(stderr, "mono_return_short8_nested sn8.f2: got %d but expected %d\n", sn8.f2, 2);
6530 fprintf(stderr, "mono_return_short8_nested sn8.f3: got %d but expected %d\n", sn8.f3, 3);
6533 fprintf(stderr, "mono_return_short8_nested sn8.f4: got %d but expected %d\n", sn8.f4, 4);
6536 fprintf(stderr, "mono_return_short8_nested sn8.f5: got %d but expected %d\n", sn8.f5, 5);
6539 fprintf(stderr, "mono_return_short8_nested sn8.f6: got %d but expected %d\n", sn8.f6, 6);
6542 fprintf(stderr, "mono_return_short8_nested sn8.f7: got %d but expected %d\n", sn8.f7, 7);
6544 if (sn8.nested2.f8 != 8) {
6545 fprintf(stderr, "mono_return_short8_nested sn8.nested2.f8: got %d but expected %d\n", sn8.nested2.f8, 8);
6547 sn8.nested1.f1+=addend; sn8.f2+=addend; sn8.f3+=addend; sn8.f4+=addend; sn8.f5+=addend; sn8.f6+=addend; sn8.f7+=addend; sn8.nested2.f8+=addend;
6556 LIBTEST_API int1 STDCALL
6557 mono_return_int1 (int1 s1, int addend) {
6559 fprintf(stderr, "mono_return_int1 s1.f1: got %d but expected %d\n", s1.f1, 1);
6569 LIBTEST_API int2 STDCALL
6570 mono_return_int2 (int2 s2, int addend) {
6572 fprintf(stderr, "mono_return_int2 s2.f1: got %d but expected %d\n", s2.f1, 1);
6575 fprintf(stderr, "mono_return_int2 s2.f2: got %d but expected %d\n", s2.f2, 2);
6577 s2.f1+=addend; s2.f2+=addend;
6585 LIBTEST_API int3 STDCALL
6586 mono_return_int3 (int3 s3, int addend) {
6588 fprintf(stderr, "mono_return_int3 s3.f1: got %d but expected %d\n", s3.f1, 1);
6591 fprintf(stderr, "mono_return_int3 s3.f2: got %d but expected %d\n", s3.f2, 2);
6594 fprintf(stderr, "mono_return_int3 s3.f3: got %d but expected %d\n", s3.f3, 3);
6596 s3.f1+=addend; s3.f2+=addend; s3.f3+=addend;
6604 LIBTEST_API int4 STDCALL
6605 mono_return_int4 (int4 s4, int addend) {
6607 fprintf(stderr, "mono_return_int4 s4.f1: got %d but expected %d\n", s4.f1, 1);
6610 fprintf(stderr, "mono_return_int4 s4.f2: got %d but expected %d\n", s4.f2, 2);
6613 fprintf(stderr, "mono_return_int4 s4.f3: got %d but expected %d\n", s4.f3, 3);
6616 fprintf(stderr, "mono_return_int4 s4.f4: got %d but expected %d\n", s4.f4, 4);
6618 s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend;
6626 LIBTEST_API int5 STDCALL
6627 mono_return_int5 (int5 s5, int addend) {
6629 fprintf(stderr, "mono_return_int5 s5.f1: got %d but expected %d\n", s5.f1, 1);
6632 fprintf(stderr, "mono_return_int5 s5.f2: got %d but expected %d\n", s5.f2, 2);
6635 fprintf(stderr, "mono_return_int5 s5.f3: got %d but expected %d\n", s5.f3, 3);
6638 fprintf(stderr, "mono_return_int5 s5.f4: got %d but expected %d\n", s5.f4, 4);
6641 fprintf(stderr, "mono_return_int5 s5.f5: got %d but expected %d\n", s5.f5, 5);
6643 s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend;
6657 LIBTEST_API int4_nested STDCALL
6658 mono_return_int4_nested (int4_nested sn4, int addend) {
6659 if (sn4.nested1.f1 != 1) {
6660 fprintf(stderr, "mono_return_int4_nested sn4.nested1.f1: got %d but expected %d\n", sn4.nested1.f1, 1);
6663 fprintf(stderr, "mono_return_int4_nested sn4.f2: got %d but expected %d\n", sn4.f2, 2);
6666 fprintf(stderr, "mono_return_int4_nested sn4.f3: got %d but expected %d\n", sn4.f3, 3);
6668 if (sn4.nested2.f4 != 4) {
6669 fprintf(stderr, "mono_return_int4_nested sn4.nested2.f4: got %d but expected %d\n", sn4.nested2.f4, 4);
6671 sn4.nested1.f1+=addend; sn4.f2+=addend; sn4.f3+=addend; sn4.nested2.f4+=addend;
6679 LIBTEST_API float1 STDCALL
6680 mono_return_float1 (float1 s1, int addend) {
6682 fprintf(stderr, "mono_return_float1 s1.f1: got %f but expected %d\n", s1.f1, 1);
6692 LIBTEST_API float2 STDCALL
6693 mono_return_float2 (float2 s2, int addend) {
6695 fprintf(stderr, "mono_return_float2 s2.f1: got %f but expected %d\n", s2.f1, 1);
6698 fprintf(stderr, "mono_return_float2 s2.f2: got %f but expected %d\n", s2.f2, 2);
6700 s2.f1+=addend; s2.f2+=addend;
6708 LIBTEST_API float3 STDCALL
6709 mono_return_float3 (float3 s3, int addend) {
6711 fprintf(stderr, "mono_return_float3 s3.f1: got %f but expected %d\n", s3.f1, 1);
6714 fprintf(stderr, "mono_return_float3 s3.f2: got %f but expected %d\n", s3.f2, 2);
6717 fprintf(stderr, "mono_return_float3 s3.f3: got %f but expected %d\n", s3.f3, 3);
6719 s3.f1+=addend; s3.f2+=addend; s3.f3+=addend;
6727 LIBTEST_API float4 STDCALL
6728 mono_return_float4 (float4 s4, int addend) {
6730 fprintf(stderr, "mono_return_float4 s4.f1: got %f but expected %d\n", s4.f1, 1);
6733 fprintf(stderr, "mono_return_float4 s4.f2: got %f but expected %d\n", s4.f2, 2);
6736 fprintf(stderr, "mono_return_float4 s4.f3: got %f but expected %d\n", s4.f3, 3);
6739 fprintf(stderr, "mono_return_float4 s4.f4: got %f but expected %d\n", s4.f4, 4);
6741 s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend;
6746 float f1,f2,f3,f4,f5;
6749 LIBTEST_API float5 STDCALL
6750 mono_return_float5 (float5 s5, int addend) {
6752 fprintf(stderr, "mono_return_float5 s5.f1: got %f but expected %d\n", s5.f1, 1);
6755 fprintf(stderr, "mono_return_float5 s5.f2: got %f but expected %d\n", s5.f2, 2);
6758 fprintf(stderr, "mono_return_float5 s5.f3: got %f but expected %d\n", s5.f3, 3);
6761 fprintf(stderr, "mono_return_float5 s5.f4: got %f but expected %d\n", s5.f4, 4);
6764 fprintf(stderr, "mono_return_float5 s5.f5: got %f but expected %d\n", s5.f5, 5);
6766 s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend;
6771 float f1,f2,f3,f4,f5,f6;
6774 LIBTEST_API float6 STDCALL
6775 mono_return_float6 (float6 s6, int addend) {
6777 fprintf(stderr, "mono_return_float6 s6.f1: got %f but expected %d\n", s6.f1, 1);
6780 fprintf(stderr, "mono_return_float6 s6.f2: got %f but expected %d\n", s6.f2, 2);
6783 fprintf(stderr, "mono_return_float6 s6.f3: got %f but expected %d\n", s6.f3, 3);
6786 fprintf(stderr, "mono_return_float6 s6.f4: got %f but expected %d\n", s6.f4, 4);
6789 fprintf(stderr, "mono_return_float6 s6.f5: got %f but expected %d\n", s6.f5, 5);
6792 fprintf(stderr, "mono_return_float6 s6.f6: got %f but expected %d\n", s6.f6, 6);
6794 s6.f1+=addend; s6.f2+=addend; s6.f3+=addend; s6.f4+=addend; s6.f5+=addend; s6.f6+=addend;
6799 float f1,f2,f3,f4,f5,f6,f7;
6802 LIBTEST_API float7 STDCALL
6803 mono_return_float7 (float7 s7, int addend) {
6805 fprintf(stderr, "mono_return_float7 s7.f1: got %f but expected %d\n", s7.f1, 1);
6808 fprintf(stderr, "mono_return_float7 s7.f2: got %f but expected %d\n", s7.f2, 2);
6811 fprintf(stderr, "mono_return_float7 s7.f3: got %f but expected %d\n", s7.f3, 3);
6814 fprintf(stderr, "mono_return_float7 s7.f4: got %f but expected %d\n", s7.f4, 4);
6817 fprintf(stderr, "mono_return_float7 s7.f5: got %f but expected %d\n", s7.f5, 5);
6820 fprintf(stderr, "mono_return_float7 s7.f6: got %f but expected %d\n", s7.f6, 6);
6823 fprintf(stderr, "mono_return_float7 s7.f7: got %f but expected %d\n", s7.f7, 7);
6825 s7.f1+=addend; s7.f2+=addend; s7.f3+=addend; s7.f4+=addend; s7.f5+=addend; s7.f6+=addend; s7.f7+=addend;
6830 float f1,f2,f3,f4,f5,f6,f7,f8;
6833 LIBTEST_API float8 STDCALL
6834 mono_return_float8 (float8 s8, int addend) {
6836 fprintf(stderr, "mono_return_float8 s8.f1: got %f but expected %d\n", s8.f1, 1);
6839 fprintf(stderr, "mono_return_float8 s8.f2: got %f but expected %d\n", s8.f2, 2);
6842 fprintf(stderr, "mono_return_float8 s8.f3: got %f but expected %d\n", s8.f3, 3);
6845 fprintf(stderr, "mono_return_float8 s8.f4: got %f but expected %d\n", s8.f4, 4);
6848 fprintf(stderr, "mono_return_float8 s8.f5: got %f but expected %d\n", s8.f5, 5);
6851 fprintf(stderr, "mono_return_float8 s8.f6: got %f but expected %d\n", s8.f6, 6);
6854 fprintf(stderr, "mono_return_float8 s8.f7: got %f but expected %d\n", s8.f7, 7);
6857 fprintf(stderr, "mono_return_float8 s8.f8: got %f but expected %d\n", s8.f8, 8);
6859 s8.f1+=addend; s8.f2+=addend; s8.f3+=addend; s8.f4+=addend; s8.f5+=addend; s8.f6+=addend; s8.f7+=addend; s8.f8+=addend;
6864 float f1,f2,f3,f4,f5,f6,f7,f8,f9;
6867 LIBTEST_API float9 STDCALL
6868 mono_return_float9 (float9 s9, int addend) {
6870 fprintf(stderr, "mono_return_float9 s9.f1: got %f but expected %d\n", s9.f1, 1);
6873 fprintf(stderr, "mono_return_float9 s9.f2: got %f but expected %d\n", s9.f2, 2);
6876 fprintf(stderr, "mono_return_float9 s9.f3: got %f but expected %d\n", s9.f3, 3);
6879 fprintf(stderr, "mono_return_float9 s9.f4: got %f but expected %d\n", s9.f4, 4);
6882 fprintf(stderr, "mono_return_float9 s9.f5: got %f but expected %d\n", s9.f5, 5);
6885 fprintf(stderr, "mono_return_float9 s9.f6: got %f but expected %d\n", s9.f6, 6);
6888 fprintf(stderr, "mono_return_float9 s9.f7: got %f but expected %d\n", s9.f7, 7);
6891 fprintf(stderr, "mono_return_float9 s9.f8: got %f but expected %d\n", s9.f8, 8);
6894 fprintf(stderr, "mono_return_float9 s9.f9: got %f but expected %d\n", s9.f9, 9);
6896 s9.f1+=addend; s9.f2+=addend; s9.f3+=addend; s9.f4+=addend; s9.f5+=addend; s9.f6+=addend; s9.f7+=addend; s9.f8+=addend; s9.f9+=addend;
6910 LIBTEST_API float4_nested STDCALL
6911 mono_return_float4_nested (float4_nested sn4, int addend) {
6912 if (sn4.nested1.f1 != 1) {
6913 fprintf(stderr, "mono_return_float4_nested sn4.nested1.f1: got %f but expected %d\n", sn4.nested1.f1, 1);
6916 fprintf(stderr, "mono_return_float4_nested sn4.f2: got %f but expected %d\n", sn4.f2, 2);
6919 fprintf(stderr, "mono_return_float4_nested sn4.f3: got %f but expected %d\n", sn4.f3, 3);
6921 if (sn4.nested2.f4 != 4) {
6922 fprintf(stderr, "mono_return_float4_nested sn4.nested2.f4: got %f but expected %d\n", sn4.nested2.f4, 4);
6924 sn4.nested1.f1+=addend; sn4.f2+=addend; sn4.f3+=addend; sn4.nested2.f4+=addend;
6932 LIBTEST_API double1 STDCALL
6933 mono_return_double1 (double1 s1, int addend) {
6935 fprintf(stderr, "mono_return_double1 s1.f1: got %f but expected %d\n", s1.f1, 1);
6945 LIBTEST_API double2 STDCALL
6946 mono_return_double2 (double2 s2, int addend) {
6948 fprintf(stderr, "mono_return_double2 s2.f1: got %f but expected %d\n", s2.f1, 1);
6951 fprintf(stderr, "mono_return_double2 s2.f2: got %f but expected %d\n", s2.f2, 2);
6953 s2.f1+=addend; s2.f2+=addend;
6961 LIBTEST_API double3 STDCALL
6962 mono_return_double3 (double3 s3, int addend) {
6964 fprintf(stderr, "mono_return_double3 s3.f1: got %f but expected %d\n", s3.f1, 1);
6967 fprintf(stderr, "mono_return_double3 s3.f2: got %f but expected %d\n", s3.f2, 2);
6970 fprintf(stderr, "mono_return_double3 s3.f3: got %f but expected %d\n", s3.f3, 3);
6972 s3.f1+=addend; s3.f2+=addend; s3.f3+=addend;
6980 LIBTEST_API double4 STDCALL
6981 mono_return_double4 (double4 s4, int addend) {
6983 fprintf(stderr, "mono_return_double4 s4.f1: got %f but expected %d\n", s4.f1, 1);
6986 fprintf(stderr, "mono_return_double4 s4.f2: got %f but expected %d\n", s4.f2, 2);
6989 fprintf(stderr, "mono_return_double4 s4.f3: got %f but expected %d\n", s4.f3, 3);
6992 fprintf(stderr, "mono_return_double4 s4.f4: got %f but expected %d\n", s4.f4, 4);
6994 s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend;
6999 double f1,f2,f3,f4,f5;
7002 LIBTEST_API double5 STDCALL
7003 mono_return_double5 (double5 s5, int addend) {
7005 fprintf(stderr, "mono_return_double5 s5.f1: got %f but expected %d\n", s5.f1, 1);
7008 fprintf(stderr, "mono_return_double5 s5.f2: got %f but expected %d\n", s5.f2, 2);
7011 fprintf(stderr, "mono_return_double5 s5.f3: got %f but expected %d\n", s5.f3, 3);
7014 fprintf(stderr, "mono_return_double5 s5.f4: got %f but expected %d\n", s5.f4, 4);
7017 fprintf(stderr, "mono_return_double5 s5.f5: got %f but expected %d\n", s5.f5, 5);
7019 s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend;
7024 double f1,f2,f3,f4,f5,f6;
7027 LIBTEST_API double6 STDCALL
7028 mono_return_double6 (double6 s6, int addend) {
7030 fprintf(stderr, "mono_return_double6 s6.f1: got %f but expected %d\n", s6.f1, 1);
7033 fprintf(stderr, "mono_return_double6 s6.f2: got %f but expected %d\n", s6.f2, 2);
7036 fprintf(stderr, "mono_return_double6 s6.f3: got %f but expected %d\n", s6.f3, 3);
7039 fprintf(stderr, "mono_return_double6 s6.f4: got %f but expected %d\n", s6.f4, 4);
7042 fprintf(stderr, "mono_return_double6 s6.f5: got %f but expected %d\n", s6.f5, 5);
7045 fprintf(stderr, "mono_return_double6 s6.f6: got %f but expected %d\n", s6.f6, 6);
7047 s6.f1+=addend; s6.f2+=addend; s6.f3+=addend; s6.f4+=addend; s6.f5+=addend; s6.f6+=addend;
7052 double f1,f2,f3,f4,f5,f6,f7;
7055 LIBTEST_API double7 STDCALL
7056 mono_return_double7 (double7 s7, int addend) {
7058 fprintf(stderr, "mono_return_double7 s7.f1: got %f but expected %d\n", s7.f1, 1);
7061 fprintf(stderr, "mono_return_double7 s7.f2: got %f but expected %d\n", s7.f2, 2);
7064 fprintf(stderr, "mono_return_double7 s7.f3: got %f but expected %d\n", s7.f3, 3);
7067 fprintf(stderr, "mono_return_double7 s7.f4: got %f but expected %d\n", s7.f4, 4);
7070 fprintf(stderr, "mono_return_double7 s7.f5: got %f but expected %d\n", s7.f5, 5);
7073 fprintf(stderr, "mono_return_double7 s7.f6: got %f but expected %d\n", s7.f6, 6);
7076 fprintf(stderr, "mono_return_double7 s7.f7: got %f but expected %d\n", s7.f7, 7);
7078 s7.f1+=addend; s7.f2+=addend; s7.f3+=addend; s7.f4+=addend; s7.f5+=addend; s7.f6+=addend; s7.f7+=addend;
7083 double f1,f2,f3,f4,f5,f6,f7,f8;
7086 LIBTEST_API double8 STDCALL
7087 mono_return_double8 (double8 s8, int addend) {
7089 fprintf(stderr, "mono_return_double8 s8.f1: got %f but expected %d\n", s8.f1, 1);
7092 fprintf(stderr, "mono_return_double8 s8.f2: got %f but expected %d\n", s8.f2, 2);
7095 fprintf(stderr, "mono_return_double8 s8.f3: got %f but expected %d\n", s8.f3, 3);
7098 fprintf(stderr, "mono_return_double8 s8.f4: got %f but expected %d\n", s8.f4, 4);
7101 fprintf(stderr, "mono_return_double8 s8.f5: got %f but expected %d\n", s8.f5, 5);
7104 fprintf(stderr, "mono_return_double8 s8.f6: got %f but expected %d\n", s8.f6, 6);
7107 fprintf(stderr, "mono_return_double8 s8.f7: got %f but expected %d\n", s8.f7, 7);
7110 fprintf(stderr, "mono_return_double8 s8.f8: got %f but expected %d\n", s8.f8, 8);
7112 s8.f1+=addend; s8.f2+=addend; s8.f3+=addend; s8.f4+=addend; s8.f5+=addend; s8.f6+=addend; s8.f7+=addend; s8.f8+=addend;
7117 double f1,f2,f3,f4,f5,f6,f7,f8,f9;
7120 LIBTEST_API double9 STDCALL
7121 mono_return_double9 (double9 s9, int addend) {
7123 fprintf(stderr, "mono_return_double9 s9.f1: got %f but expected %d\n", s9.f1, 1);
7126 fprintf(stderr, "mono_return_double9 s9.f2: got %f but expected %d\n", s9.f2, 2);
7129 fprintf(stderr, "mono_return_double9 s9.f3: got %f but expected %d\n", s9.f3, 3);
7132 fprintf(stderr, "mono_return_double9 s9.f4: got %f but expected %d\n", s9.f4, 4);
7135 fprintf(stderr, "mono_return_double9 s9.f5: got %f but expected %d\n", s9.f5, 5);
7138 fprintf(stderr, "mono_return_double9 s9.f6: got %f but expected %d\n", s9.f6, 6);
7141 fprintf(stderr, "mono_return_double9 s9.f7: got %f but expected %d\n", s9.f7, 7);
7144 fprintf(stderr, "mono_return_double9 s9.f8: got %f but expected %d\n", s9.f8, 8);
7147 fprintf(stderr, "mono_return_double9 s9.f9: got %f but expected %d\n", s9.f9, 9);
7149 s9.f1+=addend; s9.f2+=addend; s9.f3+=addend; s9.f4+=addend; s9.f5+=addend; s9.f6+=addend; s9.f7+=addend; s9.f8+=addend; s9.f9+=addend;
7162 LIBTEST_API double2_nested STDCALL
7163 mono_return_double2_nested (double2_nested sn2, int addend) {
7164 if (sn2.nested1.f1 != 1) {
7165 fprintf(stderr, "mono_return_double2_nested sn2.nested1.f1: got %f but expected %d\n", sn2.nested1.f1, 1);
7167 if (sn2.nested2.f2 != 2) {
7168 fprintf(stderr, "mono_return_double2_nested sn2.nested2.f2: got %f but expected %d\n", sn2.nested2.f2, 2);
7170 sn2.nested1.f1+=addend; sn2.nested2.f2+=addend;
7180 LIBTEST_API double_array4 STDCALL
7181 mono_return_double_array4 (double_array4 sa4, int addend) {
7182 if (sa4.f1[0] != 1) {
7183 fprintf(stderr, "mono_return_double_array4 sa4.f1[0]: got %f but expected %d\n", sa4.f1[0], 1);
7185 if (sa4.f1[1] != 2) {
7186 fprintf(stderr, "mono_return_double_array4 sa4.f1[1]: got %f but expected %d\n", sa4.f1[1], 2);
7188 if (sa4.f1[2] != 3) {
7189 fprintf(stderr, "mono_return_double_array4 sa4.f1[2]: got %f but expected %d\n", sa4.f1[2], 3);
7191 if (sa4.f1[3] != 4) {
7192 fprintf(stderr, "mono_return_double_array4 sa4.f1[3]: got %f but expected %d\n", sa4.f1[3], 4);
7194 sa4.f1[0]+=addend; sa4.f1[1]+=addend; sa4.f1[2]+=addend; sa4.f1[3]+=addend;