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 LIBTEST_API int STDCALL
1113 mono_test_marshal_stringbuilder (char *s, int n)
1115 const char m[] = "This is my message. Isn't it nice?";
1117 if (strcmp (s, "ABCD") != 0)
1124 LIBTEST_API int STDCALL
1125 mono_test_marshal_stringbuilder_append (char *s, int length)
1127 const char out_sentinel[] = "CSHARP_";
1128 const char out_len = strlen (out_sentinel);
1130 for (int i=0; i < length; i++) {
1131 s [i] = out_sentinel [i % out_len];
1140 LIBTEST_API int STDCALL
1141 mono_test_marshal_stringbuilder_default (char *s, int n)
1143 const char m[] = "This is my message. Isn't it nice?";
1150 LIBTEST_API int STDCALL
1151 mono_test_marshal_stringbuilder_unicode (gunichar2 *s, int n)
1153 const char m[] = "This is my message. Isn't it nice?";
1157 s2 = g_utf8_to_utf16 (m, -1, NULL, &len, NULL);
1159 len = (len * 2) + 2;
1162 memcpy (s, s2, len);
1169 LIBTEST_API void STDCALL
1170 mono_test_marshal_stringbuilder_out (char **s)
1172 const char m[] = "This is my message. Isn't it nice?";
1175 str = (char *)marshal_alloc (strlen (m) + 1);
1176 memcpy (str, m, strlen (m) + 1);
1181 LIBTEST_API int STDCALL
1182 mono_test_marshal_stringbuilder_out_unicode (gunichar2 **s)
1184 const char m[] = "This is my message. Isn't it nice?";
1188 s2 = g_utf8_to_utf16 (m, -1, NULL, &len, NULL);
1190 len = (len * 2) + 2;
1191 *s = (gunichar2 *)marshal_alloc (len);
1192 memcpy (*s, s2, len);
1199 LIBTEST_API int STDCALL
1200 mono_test_marshal_stringbuilder_ref (char **s)
1202 const char m[] = "This is my message. Isn't it nice?";
1205 if (strcmp (*s, "ABC"))
1208 str = (char *)marshal_alloc (strlen (m) + 1);
1209 memcpy (str, m, strlen (m) + 1);
1215 #pragma GCC diagnostic push
1216 #pragma GCC diagnostic ignored "-Wc++-compat"
1222 #pragma GCC diagnostic pop
1224 LIBTEST_API int STDCALL
1225 mono_test_marshal_empty_string_array (char **array)
1227 return (array == NULL) ? 0 : 1;
1230 LIBTEST_API int STDCALL
1231 mono_test_marshal_string_array (char **array)
1233 if (strcmp (array [0], "ABC"))
1235 if (strcmp (array [1], "DEF"))
1238 if (array [2] != NULL)
1244 LIBTEST_API int STDCALL
1245 mono_test_marshal_byref_string_array (char ***array)
1250 if (strcmp ((*array) [0], "Alpha"))
1252 if (strcmp ((*array) [1], "Beta"))
1254 if (strcmp ((*array) [2], "Gamma"))
1260 LIBTEST_API int STDCALL
1261 mono_test_marshal_stringbuilder_array (char **array)
1263 if (strcmp (array [0], "ABC"))
1265 if (strcmp (array [1], "DEF"))
1268 strcpy (array [0], "DEF");
1269 strcpy (array [1], "ABC");
1274 LIBTEST_API int STDCALL
1275 mono_test_marshal_unicode_string_array (gunichar2 **array, char **array2)
1277 GError *error = NULL;
1280 s = g_utf16_to_utf8 (array [0], -1, NULL, NULL, &error);
1281 if (strcmp (s, "ABC")) {
1288 s = g_utf16_to_utf8 (array [1], -1, NULL, NULL, &error);
1289 if (strcmp (s, "DEF")) {
1296 if (strcmp (array2 [0], "ABC"))
1299 if (strcmp (array2 [1], "DEF"))
1305 /* this does not work on Redhat gcc 2.96 */
1306 LIBTEST_API int STDCALL
1307 mono_test_empty_struct (int a, EmptyStruct es, int b)
1309 // printf ("mono_test_empty_struct %d %d\n", a, b);
1311 // Intel icc on ia64 passes 'es' in 2 registers
1312 #if defined(__ia64) && defined(__INTEL_COMPILER)
1315 if (a == 1 && b == 2)
1321 LIBTEST_API EmptyStruct STDCALL
1322 mono_test_return_empty_struct (int a)
1335 LIBTEST_API ByValStrStruct * STDCALL
1336 mono_test_byvalstr_gen (void)
1338 ByValStrStruct *ret;
1340 ret = (ByValStrStruct *)malloc (sizeof (ByValStrStruct));
1341 memset(ret, 'a', sizeof(ByValStrStruct)-1);
1342 ret->a[sizeof(ByValStrStruct)-1] = 0;
1347 LIBTEST_API int STDCALL
1348 mono_test_byvalstr_check (ByValStrStruct* data, char* correctString)
1352 ret = strcmp(data->a, correctString);
1353 // printf ("T1: %s\n", data->a);
1354 // printf ("T2: %s\n", correctString);
1356 /* we need g_free because the allocation was performed by mono_test_byvalstr_gen */
1364 } ByValStrStruct_Unicode;
1366 LIBTEST_API int STDCALL
1367 mono_test_byvalstr_check_unicode (ByValStrStruct_Unicode *ref, int test)
1369 if (ref->flag != 0x1234abcd){
1370 printf ("overwritten data");
1374 if (test == 1 || test == 3){
1375 if (ref->a [0] != '1' ||
1376 ref->a [1] != '2' ||
1382 if (ref->a [0] != '1' ||
1390 LIBTEST_API int STDCALL
1391 NameManglingAnsi (char *data)
1393 return data [0] + data [1] + data [2];
1396 LIBTEST_API int STDCALL
1397 NameManglingAnsiA (char *data)
1399 g_assert_not_reached ();
1402 LIBTEST_API int STDCALL
1403 NameManglingAnsiW (char *data)
1405 g_assert_not_reached ();
1408 LIBTEST_API int STDCALL
1409 NameManglingAnsi2A (char *data)
1411 return data [0] + data [1] + data [2];
1414 LIBTEST_API int STDCALL
1415 NameManglingAnsi2W (char *data)
1417 g_assert_not_reached ();
1420 LIBTEST_API int STDCALL
1421 NameManglingUnicode (char *data)
1423 g_assert_not_reached ();
1426 LIBTEST_API int STDCALL
1427 NameManglingUnicodeW (gunichar2 *data)
1429 return data [0] + data [1] + data [2];
1432 LIBTEST_API int STDCALL
1433 NameManglingUnicode2 (gunichar2 *data)
1435 return data [0] + data [1] + data [2];
1438 LIBTEST_API int STDCALL
1439 NameManglingAutoW (char *data)
1442 return (data [0] + data [1] + data [2]) == 131 ? 0 : 1;
1444 g_assert_not_reached ();
1448 LIBTEST_API int STDCALL
1449 NameManglingAuto (char *data)
1452 return (data [0] + data [1] + data [2]) == 198 ? 0 : 1;
1454 g_assert_not_reached ();
1458 typedef int (STDCALL *intcharFunc)(const char*);
1460 LIBTEST_API void STDCALL
1461 callFunction (intcharFunc f)
1471 LIBTEST_API int STDCALL
1472 class_marshal_test0 (SimpleObj *obj1)
1474 // printf ("class_marshal_test0 %s %d\n", obj1->str, obj1->i);
1476 if (strcmp(obj1->str, "T1"))
1484 LIBTEST_API int STDCALL
1485 class_marshal_test4 (SimpleObj *obj1)
1493 LIBTEST_API void STDCALL
1494 class_marshal_test1 (SimpleObj **obj1)
1496 SimpleObj *res = (SimpleObj *)malloc (sizeof (SimpleObj));
1498 res->str = marshal_strdup ("ABC");
1504 LIBTEST_API int STDCALL
1505 class_marshal_test2 (SimpleObj **obj1)
1507 // printf ("class_marshal_test2 %s %d\n", (*obj1)->str, (*obj1)->i);
1509 if (strcmp((*obj1)->str, "ABC"))
1511 if ((*obj1)->i != 5)
1517 LIBTEST_API int STDCALL
1518 string_marshal_test0 (char *str)
1520 if (strcmp (str, "TEST0"))
1526 LIBTEST_API void STDCALL
1527 string_marshal_test1 (const char **str)
1529 *str = marshal_strdup ("TEST1");
1532 LIBTEST_API int STDCALL
1533 string_marshal_test2 (char **str)
1535 // printf ("string_marshal_test2 %s\n", *str);
1537 if (strcmp (*str, "TEST1"))
1540 *str = marshal_strdup ("TEST2");
1545 LIBTEST_API int STDCALL
1546 string_marshal_test3 (char *str)
1559 LIBTEST_API BlittableClass* STDCALL
1560 TestBlittableClass (BlittableClass *vl)
1562 BlittableClass *res;
1564 // printf ("TestBlittableClass %d %d\n", vl->a, vl->b);
1570 res = marshal_new0 (BlittableClass, 1);
1571 memcpy (res, vl, sizeof (BlittableClass));
1573 res = marshal_new0 (BlittableClass, 1);
1581 typedef struct OSVERSIONINFO_STRUCT
1585 } OSVERSIONINFO_STRUCT;
1587 LIBTEST_API int STDCALL
1588 MyGetVersionEx (OSVERSIONINFO_STRUCT *osvi)
1591 // printf ("GOT %d %d\n", osvi->a, osvi->b);
1596 return osvi->a + osvi->b;
1599 LIBTEST_API int STDCALL
1600 BugGetVersionEx (int a, int b, int c, int d, int e, int f, int g, int h, OSVERSIONINFO_STRUCT *osvi)
1603 // printf ("GOT %d %d\n", osvi->a, osvi->b);
1608 return osvi->a + osvi->b;
1611 LIBTEST_API int STDCALL
1612 mono_test_marshal_point (point pt)
1614 // printf("point %g %g\n", pt.x, pt.y);
1615 if (pt.x == 1.25 && pt.y == 3.5)
1626 LIBTEST_API int STDCALL
1627 mono_test_marshal_mixed_point (mixed_point pt)
1629 // printf("mixed point %d %g\n", pt.x, pt.y);
1630 if (pt.x == 5 && pt.y == 6.75)
1636 LIBTEST_API int STDCALL
1637 mono_test_marshal_mixed_point_2 (mixed_point *pt)
1639 if (pt->x != 5 || pt->y != 6.75)
1648 LIBTEST_API int STDCALL
1649 marshal_test_ref_bool(int i, char *b1, short *b2, int *b3)
1652 if (*b1 != 0 && *b1 != 1)
1654 if (*b2 != 0 && *b2 != -1) /* variant_bool */
1656 if (*b3 != 0 && *b3 != 1)
1658 if (i == ((*b1 << 2) | (-*b2 << 1) | *b3))
1670 short b2; /* variant_bool */
1674 LIBTEST_API int STDCALL
1675 marshal_test_bool_struct(struct BoolStruct *s)
1678 if (s->b1 != 0 && s->b1 != 1)
1680 if (s->b2 != 0 && s->b2 != -1)
1682 if (s->b3 != 0 && s->b3 != 1)
1684 if (s->i == ((s->b1 << 2) | (-s->b2 << 1) | s->b3))
1701 LIBTEST_API int STDCALL
1702 mono_test_marshal_long_struct (LongStruct *s)
1704 return s->i + s->l.l;
1707 LIBTEST_API void STDCALL
1708 mono_test_last_error (int err)
1717 LIBTEST_API int STDCALL
1718 mono_test_asany (void *ptr, int what)
1722 return (*(int*)ptr == 5) ? 0 : 1;
1724 return strcmp (ptr, "ABC") == 0 ? 0 : 1;
1726 simplestruct2 ss = *(simplestruct2*)ptr;
1728 if (ss.a == 0 && ss.b == 1 && ss.c == 0 &&
1729 !strcmp (ss.d, "TEST") &&
1730 ss.e == 99 && ss.f == 1.5 && ss.g == 42 && ss.h == (guint64)123)
1736 GError *error = NULL;
1739 s = g_utf16_to_utf8 ((const gunichar2 *)ptr, -1, NULL, NULL, &error);
1744 if (!strcmp (s, "ABC")) {
1754 g_assert_not_reached ();
1768 LIBTEST_API int STDCALL
1769 mono_test_marshal_asany_in (void* ptr)
1771 AsAnyStruct *asAny = (AsAnyStruct *)ptr;
1772 int res = asAny->i + asAny->j + asAny->k;
1777 LIBTEST_API int STDCALL
1778 mono_test_marshal_asany_inout (void* ptr)
1780 AsAnyStruct *asAny = (AsAnyStruct *)ptr;
1781 int res = asAny->i + asAny->j + asAny->k;
1783 marshal_free (asAny->s);
1793 LIBTEST_API int STDCALL
1794 mono_test_marshal_asany_out (void* ptr)
1796 AsAnyStruct *asAny = (AsAnyStruct *)ptr;
1797 int res = asAny->i + asAny->j + asAny->k;
1808 * AMD64 marshalling tests.
1811 typedef struct amd64_struct1 {
1818 LIBTEST_API amd64_struct1 STDCALL
1819 mono_test_marshal_amd64_pass_return_struct1 (amd64_struct1 s)
1829 LIBTEST_API amd64_struct1 STDCALL
1830 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)
1835 s.l += 1 + i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8;
1840 typedef struct amd64_struct2 {
1845 LIBTEST_API amd64_struct2 STDCALL
1846 mono_test_marshal_amd64_pass_return_struct2 (amd64_struct2 s)
1854 typedef struct amd64_struct3 {
1858 LIBTEST_API amd64_struct3 STDCALL
1859 mono_test_marshal_amd64_pass_return_struct3 (amd64_struct3 s)
1866 typedef struct amd64_struct4 {
1870 LIBTEST_API amd64_struct4 STDCALL
1871 mono_test_marshal_amd64_pass_return_struct4 (amd64_struct4 s)
1880 * IA64 marshalling tests.
1882 typedef struct test_struct5 {
1886 LIBTEST_API test_struct5 STDCALL
1887 mono_test_marshal_ia64_pass_return_struct5 (double d1, double d2, test_struct5 s, int i, double d3, double d4)
1889 s.d1 += d1 + d2 + i;
1890 s.d2 += d3 + d4 + i;
1895 typedef struct test_struct6 {
1899 LIBTEST_API test_struct6 STDCALL
1900 mono_test_marshal_ia64_pass_return_struct6 (double d1, double d2, test_struct6 s, int i, double d3, double d4)
1902 s.d1 += d1 + d2 + i;
1908 static guint32 custom_res [2];
1910 LIBTEST_API void* STDCALL
1911 mono_test_marshal_pass_return_custom (int i, guint32 *ptr, int j)
1913 /* ptr will be freed by CleanupNative, so make a copy */
1914 custom_res [0] = 0; /* not allocated by AllocHGlobal */
1915 custom_res [1] = ptr [1];
1920 LIBTEST_API int STDCALL
1921 mono_test_marshal_pass_out_custom (int i, guint32 **ptr, int j)
1924 custom_res [1] = i + j + 10;
1931 LIBTEST_API int STDCALL
1932 mono_test_marshal_pass_inout_custom (int i, guint32 *ptr, int j)
1935 ptr [1] = i + ptr [1] + j;
1940 LIBTEST_API int STDCALL
1941 mono_test_marshal_pass_out_byval_custom (int i, guint32 *ptr, int j)
1943 return ptr == NULL ? 0 : 1;
1946 LIBTEST_API int STDCALL
1947 mono_test_marshal_pass_byref_custom (int i, guint32 **ptr, int j)
1954 LIBTEST_API void* STDCALL
1955 mono_test_marshal_pass_return_custom2 (int i, guint32 *ptr, int j)
1957 g_assert_not_reached ();
1962 LIBTEST_API void* STDCALL
1963 mono_test_marshal_pass_return_custom_null (int i, guint32 *ptr, int j)
1965 g_assert (ptr == NULL);
1970 typedef void *(STDCALL *PassReturnPtrDelegate) (void *ptr);
1972 LIBTEST_API int STDCALL
1973 mono_test_marshal_pass_return_custom_in_delegate (PassReturnPtrDelegate del)
1982 ptr = (guint32 *)del (&buf);
1987 /* FIXME: Freed with FreeHGlobal */
1995 LIBTEST_API int STDCALL
1996 mono_test_marshal_pass_return_custom_null_in_delegate (PassReturnPtrDelegate del)
1998 void *ptr = del (NULL);
2000 return (ptr == NULL) ? 15 : 0;
2003 typedef void (STDCALL *CustomOutParamDelegate) (void **pptr);
2005 LIBTEST_API int STDCALL
2006 mono_test_marshal_custom_out_param_delegate (CustomOutParamDelegate del)
2018 typedef int (STDCALL *ReturnEnumDelegate) (int e);
2020 LIBTEST_API int STDCALL
2021 mono_test_marshal_return_enum_delegate (ReturnEnumDelegate func)
2031 typedef BlittableStruct (STDCALL *SimpleDelegate10) (BlittableStruct ss);
2033 LIBTEST_API int STDCALL
2034 mono_test_marshal_blittable_struct_delegate (SimpleDelegate10 delegate)
2036 BlittableStruct ss, res;
2043 res = delegate (ss);
2044 if (! ((res.a == -1) && (res.b == -2) && (res.c == -3) && (res.d == -55)))
2050 LIBTEST_API int STDCALL
2051 mono_test_stdcall_name_mangling (int a, int b, int c)
2057 mono_test_stdcall_mismatch_1 (int a, int b, int c)
2062 LIBTEST_API int STDCALL
2063 mono_test_stdcall_mismatch_2 (int a, int b, int c)
2069 * PASSING AND RETURNING SMALL STRUCTURES FROM DELEGATES TESTS
2076 typedef SmallStruct1 (STDCALL *SmallStructDelegate1) (SmallStruct1 ss);
2078 LIBTEST_API int STDCALL
2079 mono_test_marshal_small_struct_delegate1 (SmallStructDelegate1 delegate)
2081 SmallStruct1 ss, res;
2085 res = delegate (ss);
2086 if (! (res.i == -1))
2096 typedef SmallStruct2 (STDCALL *SmallStructDelegate2) (SmallStruct2 ss);
2098 LIBTEST_API int STDCALL
2099 mono_test_marshal_small_struct_delegate2 (SmallStructDelegate2 delegate)
2101 SmallStruct2 ss, res;
2106 res = delegate (ss);
2107 if (! ((res.i == -2) && (res.j == -3)))
2118 typedef SmallStruct3 (STDCALL *SmallStructDelegate3) (SmallStruct3 ss);
2120 LIBTEST_API int STDCALL
2121 mono_test_marshal_small_struct_delegate3 (SmallStructDelegate3 delegate)
2123 SmallStruct3 ss, res;
2128 res = delegate (ss);
2129 if (! ((res.i == -1) && (res.j == -2)))
2139 typedef SmallStruct4 (STDCALL *SmallStructDelegate4) (SmallStruct4 ss);
2141 LIBTEST_API int STDCALL
2142 mono_test_marshal_small_struct_delegate4 (SmallStructDelegate4 delegate)
2144 SmallStruct4 ss, res;
2148 res = delegate (ss);
2149 if (! (res.i == -1))
2159 typedef SmallStruct5 (STDCALL *SmallStructDelegate5) (SmallStruct5 ss);
2161 LIBTEST_API int STDCALL
2162 mono_test_marshal_small_struct_delegate5 (SmallStructDelegate5 delegate)
2164 SmallStruct5 ss, res;
2168 res = delegate (ss);
2169 if (! (res.i == -5))
2179 typedef SmallStruct6 (STDCALL *SmallStructDelegate6) (SmallStruct6 ss);
2181 LIBTEST_API int STDCALL
2182 mono_test_marshal_small_struct_delegate6 (SmallStructDelegate6 delegate)
2184 SmallStruct6 ss, res;
2189 res = delegate (ss);
2190 if (! ((res.i == -1) && (res.j == -2)))
2201 typedef SmallStruct7 (STDCALL *SmallStructDelegate7) (SmallStruct7 ss);
2203 LIBTEST_API int STDCALL
2204 mono_test_marshal_small_struct_delegate7 (SmallStructDelegate7 delegate)
2206 SmallStruct7 ss, res;
2211 res = delegate (ss);
2212 if (! ((res.i == -1) && (res.j == -2)))
2222 typedef SmallStruct8 (STDCALL *SmallStructDelegate8) (SmallStruct8 ss);
2224 LIBTEST_API int STDCALL
2225 mono_test_marshal_small_struct_delegate8 (SmallStructDelegate8 delegate)
2227 SmallStruct8 ss, res;
2231 res = delegate (ss);
2232 if (! ((res.i == -1.0)))
2242 typedef SmallStruct9 (STDCALL *SmallStructDelegate9) (SmallStruct9 ss);
2244 LIBTEST_API int STDCALL
2245 mono_test_marshal_small_struct_delegate9 (SmallStructDelegate9 delegate)
2247 SmallStruct9 ss, res;
2251 res = delegate (ss);
2252 if (! ((res.i == -1.0)))
2262 typedef SmallStruct10 (STDCALL *SmallStructDelegate10) (SmallStruct10 ss);
2264 LIBTEST_API int STDCALL
2265 mono_test_marshal_small_struct_delegate10 (SmallStructDelegate10 delegate)
2267 SmallStruct10 ss, res;
2272 res = delegate (ss);
2273 if (! ((res.i == -1.0) && (res.j == -2.0)))
2284 typedef SmallStruct11 (STDCALL *SmallStructDelegate11) (SmallStruct11 ss);
2286 LIBTEST_API int STDCALL
2287 mono_test_marshal_small_struct_delegate11 (SmallStructDelegate11 delegate)
2289 SmallStruct11 ss, res;
2294 res = delegate (ss);
2295 if (! ((res.i == -1.0) && (res.j == -2)))
2301 typedef int (STDCALL *ArrayDelegate) (int i, char *j, void *arr);
2303 LIBTEST_API int STDCALL
2304 mono_test_marshal_array_delegate (void *arr, int len, ArrayDelegate del)
2306 return del (len, NULL, arr);
2309 typedef int (STDCALL *ArrayDelegateLong) (gint64 i, char *j, void *arr);
2311 LIBTEST_API int STDCALL
2312 mono_test_marshal_array_delegate_long (void *arr, gint64 len, ArrayDelegateLong del)
2314 return del (len, NULL, arr);
2317 LIBTEST_API int STDCALL
2318 mono_test_marshal_out_array_delegate (int *arr, int len, ArrayDelegate del)
2320 del (len, NULL, arr);
2322 if ((arr [0] != 1) || (arr [1] != 2))
2328 typedef gunichar2* (STDCALL *UnicodeStringDelegate) (gunichar2 *message);
2330 LIBTEST_API int STDCALL
2331 mono_test_marshal_return_unicode_string_delegate (UnicodeStringDelegate del)
2333 const char m[] = "abcdef";
2334 gunichar2 *s2, *res;
2337 s2 = g_utf8_to_utf16 (m, -1, NULL, &len, NULL);
2346 LIBTEST_API int STDCALL
2347 mono_test_marshal_out_string_array_delegate (char **arr, int len, ArrayDelegate del)
2349 del (len, NULL, arr);
2351 if (!strcmp (arr [0], "ABC") && !strcmp (arr [1], "DEF"))
2357 typedef int (*CdeclDelegate) (int i, int j);
2359 LIBTEST_API int STDCALL
2360 mono_test_marshal_cdecl_delegate (CdeclDelegate del)
2364 for (i = 0; i < 1000; ++i)
2370 typedef char** (STDCALL *ReturnStringArrayDelegate) (int i);
2372 LIBTEST_API int STDCALL
2373 mono_test_marshal_return_string_array_delegate (ReturnStringArrayDelegate d)
2381 if (strcmp (arr [0], "ABC") || strcmp (arr [1], "DEF"))
2391 typedef int (STDCALL *ByrefStringDelegate) (char **s);
2393 LIBTEST_API int STDCALL
2394 mono_test_marshal_byref_string_delegate (ByrefStringDelegate d)
2396 char *s = (char*)"ABC";
2403 if (!strcmp (s, "DEF"))
2413 LIBTEST_API int STDCALL
2414 add_delegate (int i, int j)
2419 LIBTEST_API gpointer STDCALL
2420 mono_test_marshal_return_fnptr (void)
2422 return &add_delegate;
2425 LIBTEST_API int STDCALL
2428 printf ("codigo %x\n", code);
2436 LIBTEST_API HandleRef STDCALL
2437 mono_xr_as_handle (int code)
2441 memset (&ref, 0, sizeof (ref));
2453 LIBTEST_API int STDCALL
2454 mono_safe_handle_struct_ref (HandleStructs *x)
2456 printf ("Dingus Ref! \n");
2457 printf ("Values: %d %d %p %p\n", x->a, x->b, x->handle1, x->handle2);
2463 if (x->handle1 != (void*) 0x7080feed)
2466 if (x->handle2 != (void*) 0x1234abcd)
2472 LIBTEST_API int STDCALL
2473 mono_safe_handle_struct (HandleStructs x)
2475 printf ("Dingus Standard! \n");
2476 printf ("Values: %d %d %p %p\n", x.a, x.b, x.handle1, x.handle2);
2482 if (x.handle1 != (void*) 0x7080feed)
2485 if (x.handle2 != (void*) 0x1234abcd)
2495 LIBTEST_API int STDCALL
2496 mono_safe_handle_struct_simple (TrivialHandle x)
2498 printf ("The value is %p\n", x.a);
2499 return ((int)(gsize)x.a) * 2;
2502 LIBTEST_API int STDCALL
2503 mono_safe_handle_return (void)
2508 LIBTEST_API void STDCALL
2509 mono_safe_handle_ref (void **handle)
2512 *handle = (void *) 0xbad;
2516 *handle = (void *) 0x800d;
2519 LIBTEST_API double STDCALL
2520 mono_test_marshal_date_time (double d, double *d2)
2592 VT_USERDEFINED = 29,
2600 VT_STREAMED_OBJECT = 68,
2601 VT_STORED_OBJECT = 69,
2602 VT_BLOB_OBJECT = 70,
2610 void VariantInit(VARIANT* vt)
2627 LIBTEST_API int STDCALL
2628 mono_test_marshal_bstr_in(gunichar2* bstr)
2631 gchar* bstr_utf8 = g_utf16_to_utf8 (bstr, -1, NULL, NULL, NULL);
2632 result = strcmp("mono_test_marshal_bstr_in", bstr_utf8);
2639 LIBTEST_API int STDCALL
2640 mono_test_marshal_bstr_out(gunichar2** bstr)
2642 *bstr = marshal_bstr_alloc ("mono_test_marshal_bstr_out");
2646 LIBTEST_API int STDCALL
2647 mono_test_marshal_bstr_in_null(gunichar2* bstr)
2654 LIBTEST_API int STDCALL
2655 mono_test_marshal_bstr_out_null(gunichar2** bstr)
2661 LIBTEST_API int STDCALL
2662 mono_test_marshal_variant_in_sbyte(VARIANT variant)
2664 if (variant.vt == VT_I1 && variant.cVal == 100)
2669 LIBTEST_API int STDCALL
2670 mono_test_marshal_variant_in_byte(VARIANT variant)
2672 if (variant.vt == VT_UI1 && variant.bVal == 100)
2677 LIBTEST_API int STDCALL
2678 mono_test_marshal_variant_in_short(VARIANT variant)
2680 if (variant.vt == VT_I2 && variant.iVal == 314)
2685 LIBTEST_API int STDCALL
2686 mono_test_marshal_variant_in_ushort(VARIANT variant)
2688 if (variant.vt == VT_UI2 && variant.uiVal == 314)
2693 LIBTEST_API int STDCALL
2694 mono_test_marshal_variant_in_int(VARIANT variant)
2696 if (variant.vt == VT_I4 && variant.lVal == 314)
2701 LIBTEST_API int STDCALL
2702 mono_test_marshal_variant_in_uint(VARIANT variant)
2704 if (variant.vt == VT_UI4 && variant.ulVal == 314)
2709 LIBTEST_API int STDCALL
2710 mono_test_marshal_variant_in_long(VARIANT variant)
2712 if (variant.vt == VT_I8 && variant.llVal == 314)
2717 LIBTEST_API int STDCALL
2718 mono_test_marshal_variant_in_ulong(VARIANT variant)
2720 if (variant.vt == VT_UI8 && variant.ullVal == 314)
2725 LIBTEST_API int STDCALL
2726 mono_test_marshal_variant_in_float(VARIANT variant)
2728 if (variant.vt == VT_R4 && (variant.fltVal - 3.14)/3.14 < .001)
2733 LIBTEST_API int STDCALL
2734 mono_test_marshal_variant_in_double(VARIANT variant)
2736 if (variant.vt == VT_R8 && (variant.dblVal - 3.14)/3.14 < .001)
2741 LIBTEST_API int STDCALL
2742 mono_test_marshal_variant_in_bstr(VARIANT variant)
2745 gchar* bstr_utf8 = g_utf16_to_utf8 (variant.bstrVal, -1, NULL, NULL, NULL);
2746 result = strcmp("PI", bstr_utf8);
2749 if (variant.vt == VT_BSTR && !result)
2754 LIBTEST_API int STDCALL
2755 mono_test_marshal_variant_in_bool_true (VARIANT variant)
2757 if (variant.vt == VT_BOOL && variant.boolVal == VARIANT_TRUE)
2762 LIBTEST_API int STDCALL
2763 mono_test_marshal_variant_in_bool_false (VARIANT variant)
2765 if (variant.vt == VT_BOOL && variant.boolVal == VARIANT_FALSE)
2770 LIBTEST_API int STDCALL
2771 mono_test_marshal_variant_out_sbyte(VARIANT* variant)
2773 variant->vt = VT_I1;
2774 variant->cVal = 100;
2779 LIBTEST_API int STDCALL
2780 mono_test_marshal_variant_out_sbyte_byref(VARIANT* variant)
2782 variant->vt = VT_I1|VT_BYREF;
2783 variant->byref = marshal_alloc(1);
2784 *((gint8*)variant->byref) = 100;
2789 LIBTEST_API int STDCALL
2790 mono_test_marshal_variant_out_byte(VARIANT* variant)
2792 variant->vt = VT_UI1;
2793 variant->bVal = 100;
2798 LIBTEST_API int STDCALL
2799 mono_test_marshal_variant_out_byte_byref(VARIANT* variant)
2801 variant->vt = VT_UI1|VT_BYREF;
2802 variant->byref = marshal_alloc(1);
2803 *((gint8*)variant->byref) = 100;
2808 LIBTEST_API int STDCALL
2809 mono_test_marshal_variant_out_short(VARIANT* variant)
2811 variant->vt = VT_I2;
2812 variant->iVal = 314;
2817 LIBTEST_API int STDCALL
2818 mono_test_marshal_variant_out_short_byref(VARIANT* variant)
2820 variant->vt = VT_I2|VT_BYREF;
2821 variant->byref = marshal_alloc(2);
2822 *((gint16*)variant->byref) = 314;
2827 LIBTEST_API int STDCALL
2828 mono_test_marshal_variant_out_ushort(VARIANT* variant)
2830 variant->vt = VT_UI2;
2831 variant->uiVal = 314;
2836 LIBTEST_API int STDCALL
2837 mono_test_marshal_variant_out_ushort_byref(VARIANT* variant)
2839 variant->vt = VT_UI2|VT_BYREF;
2840 variant->byref = marshal_alloc(2);
2841 *((guint16*)variant->byref) = 314;
2846 LIBTEST_API int STDCALL
2847 mono_test_marshal_variant_out_int(VARIANT* variant)
2849 variant->vt = VT_I4;
2850 variant->lVal = 314;
2855 LIBTEST_API int STDCALL
2856 mono_test_marshal_variant_out_int_byref(VARIANT* variant)
2858 variant->vt = VT_I4|VT_BYREF;
2859 variant->byref = marshal_alloc(4);
2860 *((gint32*)variant->byref) = 314;
2865 LIBTEST_API int STDCALL
2866 mono_test_marshal_variant_out_uint(VARIANT* variant)
2868 variant->vt = VT_UI4;
2869 variant->ulVal = 314;
2874 LIBTEST_API int STDCALL
2875 mono_test_marshal_variant_out_uint_byref(VARIANT* variant)
2877 variant->vt = VT_UI4|VT_BYREF;
2878 variant->byref = marshal_alloc(4);
2879 *((guint32*)variant->byref) = 314;
2884 LIBTEST_API int STDCALL
2885 mono_test_marshal_variant_out_long(VARIANT* variant)
2887 variant->vt = VT_I8;
2888 variant->llVal = 314;
2893 LIBTEST_API int STDCALL
2894 mono_test_marshal_variant_out_long_byref(VARIANT* variant)
2896 variant->vt = VT_I8|VT_BYREF;
2897 variant->byref = marshal_alloc(8);
2898 *((gint64*)variant->byref) = 314;
2903 LIBTEST_API int STDCALL
2904 mono_test_marshal_variant_out_ulong(VARIANT* variant)
2906 variant->vt = VT_UI8;
2907 variant->ullVal = 314;
2912 LIBTEST_API int STDCALL
2913 mono_test_marshal_variant_out_ulong_byref(VARIANT* variant)
2915 variant->vt = VT_UI8|VT_BYREF;
2916 variant->byref = marshal_alloc(8);
2917 *((guint64*)variant->byref) = 314;
2922 LIBTEST_API int STDCALL
2923 mono_test_marshal_variant_out_float(VARIANT* variant)
2925 variant->vt = VT_R4;
2926 variant->fltVal = 3.14;
2931 LIBTEST_API int STDCALL
2932 mono_test_marshal_variant_out_float_byref(VARIANT* variant)
2934 variant->vt = VT_R4|VT_BYREF;
2935 variant->byref = marshal_alloc(4);
2936 *((float*)variant->byref) = 3.14;
2941 LIBTEST_API int STDCALL
2942 mono_test_marshal_variant_out_double(VARIANT* variant)
2944 variant->vt = VT_R8;
2945 variant->dblVal = 3.14;
2950 LIBTEST_API int STDCALL
2951 mono_test_marshal_variant_out_double_byref(VARIANT* variant)
2953 variant->vt = VT_R8|VT_BYREF;
2954 variant->byref = marshal_alloc(8);
2955 *((double*)variant->byref) = 3.14;
2960 LIBTEST_API int STDCALL
2961 mono_test_marshal_variant_out_bstr(VARIANT* variant)
2963 variant->vt = VT_BSTR;
2964 variant->bstrVal = marshal_bstr_alloc("PI");
2969 LIBTEST_API int STDCALL
2970 mono_test_marshal_variant_out_bstr_byref(VARIANT* variant)
2972 variant->vt = VT_BSTR|VT_BYREF;
2973 variant->byref = marshal_alloc(sizeof(gpointer));
2974 *((gunichar**)variant->byref) = (gunichar*)marshal_bstr_alloc("PI");
2979 LIBTEST_API int STDCALL
2980 mono_test_marshal_variant_out_bool_true (VARIANT* variant)
2982 variant->vt = VT_BOOL;
2983 variant->boolVal = VARIANT_TRUE;
2988 LIBTEST_API int STDCALL
2989 mono_test_marshal_variant_out_bool_true_byref (VARIANT* variant)
2991 variant->vt = VT_BOOL|VT_BYREF;
2992 variant->byref = marshal_alloc(2);
2993 *((gint16*)variant->byref) = VARIANT_TRUE;
2998 LIBTEST_API int STDCALL
2999 mono_test_marshal_variant_out_bool_false (VARIANT* variant)
3001 variant->vt = VT_BOOL;
3002 variant->boolVal = VARIANT_FALSE;
3007 LIBTEST_API int STDCALL
3008 mono_test_marshal_variant_out_bool_false_byref (VARIANT* variant)
3010 variant->vt = VT_BOOL|VT_BYREF;
3011 variant->byref = marshal_alloc(2);
3012 *((gint16*)variant->byref) = VARIANT_FALSE;
3017 typedef int (STDCALL *VarFunc) (int vt, VARIANT variant);
3018 typedef int (STDCALL *VarRefFunc) (int vt, VARIANT* variant);
3020 LIBTEST_API int STDCALL
3021 mono_test_marshal_variant_in_sbyte_unmanaged(VarFunc func)
3026 return func (VT_I1, vt);
3029 LIBTEST_API int STDCALL
3030 mono_test_marshal_variant_in_byte_unmanaged(VarFunc func)
3035 return func (VT_UI1, vt);
3038 LIBTEST_API int STDCALL
3039 mono_test_marshal_variant_in_short_unmanaged(VarFunc func)
3044 return func (VT_I2, vt);
3047 LIBTEST_API int STDCALL
3048 mono_test_marshal_variant_in_ushort_unmanaged(VarFunc func)
3053 return func (VT_UI2, vt);
3056 LIBTEST_API int STDCALL
3057 mono_test_marshal_variant_in_int_unmanaged(VarFunc func)
3062 return func (VT_I4, vt);
3065 LIBTEST_API int STDCALL
3066 mono_test_marshal_variant_in_uint_unmanaged(VarFunc func)
3071 return func (VT_UI4, vt);
3074 LIBTEST_API int STDCALL
3075 mono_test_marshal_variant_in_long_unmanaged(VarFunc func)
3080 return func (VT_I8, vt);
3083 LIBTEST_API int STDCALL
3084 mono_test_marshal_variant_in_ulong_unmanaged(VarFunc func)
3089 return func (VT_UI8, vt);
3092 LIBTEST_API int STDCALL
3093 mono_test_marshal_variant_in_float_unmanaged(VarFunc func)
3098 return func (VT_R4, vt);
3101 LIBTEST_API int STDCALL
3102 mono_test_marshal_variant_in_double_unmanaged(VarFunc func)
3107 return func (VT_R8, vt);
3110 LIBTEST_API int STDCALL
3111 mono_test_marshal_variant_in_bstr_unmanaged(VarFunc func)
3115 vt.bstrVal = marshal_bstr_alloc("PI");
3116 return func (VT_BSTR, vt);
3119 LIBTEST_API int STDCALL
3120 mono_test_marshal_variant_in_bool_true_unmanaged(VarFunc func)
3124 vt.boolVal = VARIANT_TRUE;
3125 return func (VT_BOOL, vt);
3128 LIBTEST_API int STDCALL
3129 mono_test_marshal_variant_in_bool_false_unmanaged(VarFunc func)
3133 vt.boolVal = VARIANT_FALSE;
3134 return func (VT_BOOL, vt);
3137 LIBTEST_API int STDCALL
3138 mono_test_marshal_variant_out_sbyte_unmanaged(VarRefFunc func)
3143 if (vt.vt == VT_I1 && vt.cVal == -100)
3148 LIBTEST_API int STDCALL
3149 mono_test_marshal_variant_out_byte_unmanaged(VarRefFunc func)
3154 if (vt.vt == VT_UI1 && vt.bVal == 100)
3159 LIBTEST_API int STDCALL
3160 mono_test_marshal_variant_out_short_unmanaged(VarRefFunc func)
3165 if (vt.vt == VT_I2 && vt.iVal == -100)
3170 LIBTEST_API int STDCALL
3171 mono_test_marshal_variant_out_ushort_unmanaged(VarRefFunc func)
3176 if (vt.vt == VT_UI2 && vt.uiVal == 100)
3181 LIBTEST_API int STDCALL
3182 mono_test_marshal_variant_out_int_unmanaged(VarRefFunc func)
3187 if (vt.vt == VT_I4 && vt.lVal == -100)
3192 LIBTEST_API int STDCALL
3193 mono_test_marshal_variant_out_uint_unmanaged(VarRefFunc func)
3198 if (vt.vt == VT_UI4 && vt.ulVal == 100)
3203 LIBTEST_API int STDCALL
3204 mono_test_marshal_variant_out_long_unmanaged(VarRefFunc func)
3209 if (vt.vt == VT_I8 && vt.llVal == -100)
3214 LIBTEST_API int STDCALL
3215 mono_test_marshal_variant_out_ulong_unmanaged(VarRefFunc func)
3220 if (vt.vt == VT_UI8 && vt.ullVal == 100)
3225 LIBTEST_API int STDCALL
3226 mono_test_marshal_variant_out_float_unmanaged(VarRefFunc func)
3231 if (vt.vt == VT_R4 && fabs (vt.fltVal - 3.14f) < 1e-10)
3236 LIBTEST_API int STDCALL
3237 mono_test_marshal_variant_out_double_unmanaged(VarRefFunc func)
3242 if (vt.vt == VT_R8 && fabs (vt.dblVal - 3.14) < 1e-10)
3247 LIBTEST_API int STDCALL
3248 mono_test_marshal_variant_out_bstr_unmanaged(VarRefFunc func)
3256 func (VT_BSTR, &vt);
3257 bstr_utf8 = g_utf16_to_utf8 (vt.bstrVal, -1, NULL, NULL, NULL);
3258 result = strcmp("PI", bstr_utf8);
3260 if (vt.vt == VT_BSTR && !result)
3265 LIBTEST_API int STDCALL
3266 mono_test_marshal_variant_out_bool_true_unmanaged(VarRefFunc func)
3270 func (VT_BOOL, &vt);
3271 if (vt.vt == VT_BOOL && vt.boolVal == VARIANT_TRUE)
3276 LIBTEST_API int STDCALL
3277 mono_test_marshal_variant_out_bool_false_unmanaged(VarRefFunc func)
3281 func (VT_BOOL, &vt);
3282 if (vt.vt == VT_BOOL && vt.boolVal == VARIANT_TRUE)
3287 typedef struct MonoComObject MonoComObject;
3291 int (STDCALL *QueryInterface)(MonoComObject* pUnk, gpointer riid, gpointer* ppv);
3292 int (STDCALL *AddRef)(MonoComObject* pUnk);
3293 int (STDCALL *Release)(MonoComObject* pUnk);
3294 int (STDCALL *get_ITest)(MonoComObject* pUnk, MonoComObject* *ppUnk);
3295 int (STDCALL *SByteIn)(MonoComObject* pUnk, char a);
3296 int (STDCALL *ByteIn)(MonoComObject* pUnk, unsigned char a);
3297 int (STDCALL *ShortIn)(MonoComObject* pUnk, short a);
3298 int (STDCALL *UShortIn)(MonoComObject* pUnk, unsigned short a);
3299 int (STDCALL *IntIn)(MonoComObject* pUnk, int a);
3300 int (STDCALL *UIntIn)(MonoComObject* pUnk, unsigned int a);
3301 int (STDCALL *LongIn)(MonoComObject* pUnk, gint64 a);
3302 int (STDCALL *ULongIn)(MonoComObject* pUnk, guint64 a);
3303 int (STDCALL *FloatIn)(MonoComObject* pUnk, float a);
3304 int (STDCALL *DoubleIn)(MonoComObject* pUnk, double a);
3305 int (STDCALL *ITestIn)(MonoComObject* pUnk, MonoComObject* pUnk2);
3306 int (STDCALL *ITestOut)(MonoComObject* pUnk, MonoComObject* *ppUnk);
3309 struct MonoComObject
3315 static GUID IID_ITest = {0, 0, 0, {0,0,0,0,0,0,0,1}};
3316 static GUID IID_IMonoUnknown = {0, 0, 0, {0xc0,0,0,0,0,0,0,0x46}};
3317 static GUID IID_IMonoDispatch = {0x00020400, 0, 0, {0xc0,0,0,0,0,0,0,0x46}};
3319 LIBTEST_API int STDCALL
3320 MonoQueryInterface(MonoComObject* pUnk, gpointer riid, gpointer* ppv)
3324 if (!memcmp(riid, &IID_IMonoUnknown, sizeof(GUID))) {
3328 else if (!memcmp(riid, &IID_ITest, sizeof(GUID))) {
3332 else if (!memcmp(riid, &IID_IMonoDispatch, sizeof(GUID))) {
3336 return 0x80004002; //E_NOINTERFACE;
3339 LIBTEST_API int STDCALL
3340 MonoAddRef(MonoComObject* pUnk)
3342 return ++(pUnk->m_ref);
3345 LIBTEST_API int STDCALL
3346 MonoRelease(MonoComObject* pUnk)
3348 return --(pUnk->m_ref);
3351 LIBTEST_API int STDCALL
3352 SByteIn(MonoComObject* pUnk, char a)
3357 LIBTEST_API int STDCALL
3358 ByteIn(MonoComObject* pUnk, unsigned char a)
3363 LIBTEST_API int STDCALL
3364 ShortIn(MonoComObject* pUnk, short a)
3369 LIBTEST_API int STDCALL
3370 UShortIn(MonoComObject* pUnk, unsigned short a)
3375 LIBTEST_API int STDCALL
3376 IntIn(MonoComObject* pUnk, int a)
3381 LIBTEST_API int STDCALL
3382 UIntIn(MonoComObject* pUnk, unsigned int a)
3387 LIBTEST_API int STDCALL
3388 LongIn(MonoComObject* pUnk, gint64 a)
3393 LIBTEST_API int STDCALL
3394 ULongIn(MonoComObject* pUnk, guint64 a)
3399 LIBTEST_API int STDCALL
3400 FloatIn(MonoComObject* pUnk, float a)
3405 LIBTEST_API int STDCALL
3406 DoubleIn(MonoComObject* pUnk, double a)
3411 LIBTEST_API int STDCALL
3412 ITestIn(MonoComObject* pUnk, MonoComObject *pUnk2)
3417 LIBTEST_API int STDCALL
3418 ITestOut(MonoComObject* pUnk, MonoComObject* *ppUnk)
3423 static void create_com_object (MonoComObject** pOut);
3425 LIBTEST_API int STDCALL
3426 get_ITest(MonoComObject* pUnk, MonoComObject* *ppUnk)
3428 create_com_object (ppUnk);
3432 static void create_com_object (MonoComObject** pOut)
3434 *pOut = marshal_new0 (MonoComObject, 1);
3435 (*pOut)->vtbl = marshal_new0 (MonoIUnknown, 1);
3438 (*pOut)->vtbl->QueryInterface = MonoQueryInterface;
3439 (*pOut)->vtbl->AddRef = MonoAddRef;
3440 (*pOut)->vtbl->Release = MonoRelease;
3441 (*pOut)->vtbl->SByteIn = SByteIn;
3442 (*pOut)->vtbl->ByteIn = ByteIn;
3443 (*pOut)->vtbl->ShortIn = ShortIn;
3444 (*pOut)->vtbl->UShortIn = UShortIn;
3445 (*pOut)->vtbl->IntIn = IntIn;
3446 (*pOut)->vtbl->UIntIn = UIntIn;
3447 (*pOut)->vtbl->LongIn = LongIn;
3448 (*pOut)->vtbl->ULongIn = ULongIn;
3449 (*pOut)->vtbl->FloatIn = FloatIn;
3450 (*pOut)->vtbl->DoubleIn = DoubleIn;
3451 (*pOut)->vtbl->ITestIn = ITestIn;
3452 (*pOut)->vtbl->ITestOut = ITestOut;
3453 (*pOut)->vtbl->get_ITest = get_ITest;
3456 static MonoComObject* same_object = NULL;
3458 LIBTEST_API int STDCALL
3459 mono_test_marshal_com_object_create(MonoComObject* *pUnk)
3461 create_com_object (pUnk);
3464 same_object = *pUnk;
3469 LIBTEST_API int STDCALL
3470 mono_test_marshal_com_object_same(MonoComObject* *pUnk)
3472 *pUnk = same_object;
3477 LIBTEST_API int STDCALL
3478 mono_test_marshal_com_object_destroy(MonoComObject *pUnk)
3480 int ref = --(pUnk->m_ref);
3487 LIBTEST_API int STDCALL
3488 mono_test_marshal_com_object_ref_count(MonoComObject *pUnk)
3493 LIBTEST_API int STDCALL
3494 mono_test_marshal_ccw_itest (MonoComObject *pUnk)
3497 MonoComObject* pTest;
3502 hr = pUnk->vtbl->SByteIn (pUnk, -100);
3505 hr = pUnk->vtbl->ByteIn (pUnk, 100);
3508 hr = pUnk->vtbl->ShortIn (pUnk, -100);
3511 hr = pUnk->vtbl->UShortIn (pUnk, 100);
3514 hr = pUnk->vtbl->IntIn (pUnk, -100);
3517 hr = pUnk->vtbl->UIntIn (pUnk, 100);
3520 hr = pUnk->vtbl->LongIn (pUnk, -100);
3523 hr = pUnk->vtbl->ULongIn (pUnk, 100);
3526 hr = pUnk->vtbl->FloatIn (pUnk, 3.14f);
3529 hr = pUnk->vtbl->DoubleIn (pUnk, 3.14);
3532 hr = pUnk->vtbl->ITestIn (pUnk, pUnk);
3535 hr = pUnk->vtbl->ITestOut (pUnk, &pTest);
3543 * mono_method_get_unmanaged_thunk tests
3546 #if defined(__GNUC__) && ((defined(__i386__) && (defined(__linux__) || defined (__APPLE__)) || defined (__FreeBSD__) || defined(__OpenBSD__)) || (defined(__ppc__) && defined(__APPLE__)))
3547 #define ALIGN(size) __attribute__ ((aligned(size)))
3553 /* thunks.cs:TestStruct */
3554 typedef struct _TestStruct {
3559 /* Searches for mono symbols in all loaded modules */
3561 lookup_mono_symbol (const char *symbol_name)
3564 if (g_module_symbol (g_module_open (NULL, G_MODULE_BIND_LAZY), symbol_name, &symbol))
3570 LIBTEST_API gpointer STDCALL
3571 mono_test_marshal_lookup_symbol (const char *symbol_name)
3573 return lookup_mono_symbol (symbol_name);
3576 #define MONO_BEGIN_EFRAME { void *__dummy; void *__region_cookie = mono_threads_enter_gc_unsafe_region ? mono_threads_enter_gc_unsafe_region (&__dummy) : NULL;
3577 #define MONO_END_EFRAME if (mono_threads_exit_gc_unsafe_region) mono_threads_exit_gc_unsafe_region (__region_cookie, &__dummy); }
3580 * test_method_thunk:
3582 * @test_id: the test number
3583 * @test_method_handle: MonoMethod* of the C# test method
3584 * @create_object_method_handle: MonoMethod* of thunks.cs:Test.CreateObject
3586 LIBTEST_API int STDCALL
3587 test_method_thunk (int test_id, gpointer test_method_handle, gpointer create_object_method_handle)
3591 gpointer (*mono_method_get_unmanaged_thunk)(gpointer)
3592 = (gpointer (*)(gpointer))lookup_mono_symbol ("mono_method_get_unmanaged_thunk");
3594 gpointer (*mono_string_new_wrapper)(const char *)
3595 = (gpointer (*)(const char *))lookup_mono_symbol ("mono_string_new_wrapper");
3597 char *(*mono_string_to_utf8)(gpointer)
3598 = (char *(*)(gpointer))lookup_mono_symbol ("mono_string_to_utf8");
3600 gpointer (*mono_object_unbox)(gpointer)
3601 = (gpointer (*)(gpointer))lookup_mono_symbol ("mono_object_unbox");
3603 gpointer (*mono_threads_enter_gc_unsafe_region) (gpointer)
3604 = (gpointer (*)(gpointer))lookup_mono_symbol ("mono_threads_enter_gc_unsafe_region");
3606 void (*mono_threads_exit_gc_unsafe_region) (gpointer, gpointer)
3607 = (void (*)(gpointer, gpointer))lookup_mono_symbol ("mono_threads_exit_gc_unsafe_region");
3611 gpointer test_method, ex = NULL;
3612 gpointer (STDCALL *CreateObject)(gpointer*);
3616 if (!mono_method_get_unmanaged_thunk) {
3621 test_method = mono_method_get_unmanaged_thunk (test_method_handle);
3627 CreateObject = (gpointer (STDCALL *)(gpointer *))mono_method_get_unmanaged_thunk (create_object_method_handle);
3628 if (!CreateObject) {
3637 /* thunks.cs:Test.Test0 */
3638 void (STDCALL *F)(gpointer *) = (void (STDCALL *)(gpointer *))test_method;
3644 /* thunks.cs:Test.Test1 */
3645 int (STDCALL *F)(gpointer *) = (int (STDCALL *)(gpointer *))test_method;
3646 if (F (&ex) != 42) {
3654 /* thunks.cs:Test.Test2 */
3655 gpointer (STDCALL *F)(gpointer, gpointer*) = (gpointer (STDCALL *)(gpointer, gpointer *))test_method;
3656 gpointer str = mono_string_new_wrapper ("foo");
3657 if (str != F (str, &ex)) {
3665 /* thunks.cs:Test.Test3 */
3666 gpointer (STDCALL *F)(gpointer, gpointer, gpointer*);
3670 F = (gpointer (STDCALL *)(gpointer, gpointer, gpointer *))test_method;
3671 obj = CreateObject (&ex);
3672 str = mono_string_new_wrapper ("bar");
3674 if (str != F (obj, str, &ex)) {
3682 /* thunks.cs:Test.Test4 */
3683 int (STDCALL *F)(gpointer, gpointer, int, gpointer*);
3687 F = (int (STDCALL *)(gpointer, gpointer, int, gpointer *))test_method;
3688 obj = CreateObject (&ex);
3689 str = mono_string_new_wrapper ("bar");
3691 if (42 != F (obj, str, 42, &ex)) {
3700 /* thunks.cs:Test.Test5 */
3701 int (STDCALL *F)(gpointer, gpointer, int, gpointer*);
3705 F = (int (STDCALL *)(gpointer, gpointer, int, gpointer *))test_method;
3706 obj = CreateObject (&ex);
3707 str = mono_string_new_wrapper ("bar");
3709 F (obj, str, 42, &ex);
3719 /* thunks.cs:Test.Test6 */
3720 int (STDCALL *F)(gpointer, guint8, gint16, gint32, gint64, float, double,
3721 gpointer, gpointer*);
3723 gpointer str = mono_string_new_wrapper ("Test6");
3726 F = (int (STDCALL *)(gpointer, guint8, gint16, gint32, gint64, float, double, gpointer, gpointer *))test_method;
3727 obj = CreateObject (&ex);
3729 res = F (obj, 254, 32700, -245378, 6789600, 3.1415, 3.1415, str, &ex);
3744 /* thunks.cs:Test.Test7 */
3745 gint64 (STDCALL *F)(gpointer*) = (gint64 (STDCALL *)(gpointer *))test_method;
3746 if (F (&ex) != G_MAXINT64) {
3754 /* thunks.cs:Test.Test8 */
3755 void (STDCALL *F)(guint8*, gint16*, gint32*, gint64*, float*, double*,
3756 gpointer*, gpointer*);
3766 F = (void (STDCALL *)(guint8 *, gint16 *, gint32 *, gint64 *, float *, double *,
3767 gpointer *, gpointer *))test_method;
3769 F (&a1, &a2, &a3, &a4, &a5, &a6, &a7, &ex);
3779 (fabs (a5 - 3.1415) < 0.001) &&
3780 (fabs (a6 - 3.1415) < 0.001) &&
3781 strcmp (mono_string_to_utf8 (a7), "Test8") == 0)){
3790 /* thunks.cs:Test.Test9 */
3791 void (STDCALL *F)(guint8*, gint16*, gint32*, gint64*, float*, double*,
3792 gpointer*, gpointer*);
3802 F = (void (STDCALL *)(guint8 *, gint16 *, gint32 *, gint64 *, float *, double *,
3803 gpointer *, gpointer *))test_method;
3805 F (&a1, &a2, &a3, &a4, &a5, &a6, &a7, &ex);
3815 /* thunks.cs:Test.Test10 */
3816 void (STDCALL *F)(gpointer*, gpointer*);
3818 gpointer obj1, obj2;
3820 obj1 = obj2 = CreateObject (&ex);
3826 F = (void (STDCALL *)(gpointer *, gpointer *))test_method;
3843 /* thunks.cs:TestStruct.Test0 */
3844 int (STDCALL *F)(gpointer*, gpointer*);
3850 obj = CreateObject (&ex);
3861 a1 = (TestStruct *)mono_object_unbox (obj);
3870 F = (int (STDCALL *)(gpointer *, gpointer *))test_method;
3872 res = F ((gpointer *)obj, &ex);
3883 /* check whether the call was really by value */
3884 if (a1->A != 42 || a1->B != 3.1415) {
3893 /* thunks.cs:TestStruct.Test1 */
3894 void (STDCALL *F)(gpointer, gpointer*);
3899 obj = CreateObject (&ex);
3910 a1 = (TestStruct *)mono_object_unbox (obj);
3916 F = (void (STDCALL *)(gpointer, gpointer *))test_method;
3929 if (!(fabs (a1->B - 3.1415) < 0.001)) {
3938 /* thunks.cs:TestStruct.Test2 */
3939 gpointer (STDCALL *F)(gpointer*);
3944 F = (gpointer (STDCALL *)(gpointer *))test_method;
3957 a1 = (TestStruct *)mono_object_unbox (obj);
3964 if (!(fabs (a1->B - 3.1415) < 0.001)) {
3973 /* thunks.cs:TestStruct.Test3 */
3974 void (STDCALL *F)(gpointer, gpointer*);
3979 obj = CreateObject (&ex);
3990 a1 = (TestStruct *)mono_object_unbox (obj);
4000 F = (void (STDCALL *)(gpointer, gpointer *))test_method;
4036 LIBTEST_API int STDCALL
4037 mono_test_Winx64_struct1_in (winx64_struct1 var)
4050 LIBTEST_API int STDCALL
4051 mono_test_Winx64_struct2_in (winx64_struct2 var)
4068 LIBTEST_API int STDCALL
4069 mono_test_Winx64_struct3_in (winx64_struct3 var)
4075 if (var.c != 0x1234)
4088 LIBTEST_API int STDCALL
4089 mono_test_Winx64_struct4_in (winx64_struct4 var)
4095 if (var.c != 0x1234)
4097 if (var.d != 0x87654321)
4109 LIBTEST_API int STDCALL
4110 mono_test_Winx64_struct5_in (winx64_struct5 var)
4128 LIBTEST_API int STDCALL
4129 mono_test_Winx64_struct6_in (winx64_struct6 var)
4140 LIBTEST_API int STDCALL
4141 mono_test_Winx64_structs_in1 (winx64_struct1 var1,
4142 winx64_struct2 var2,
4143 winx64_struct3 var3,
4144 winx64_struct4 var4)
4158 if (var3.c != 0x1234)
4165 if (var4.c != 0x1234)
4167 if (var4.d != 0x87654321)
4172 LIBTEST_API int STDCALL
4173 mono_test_Winx64_structs_in2 (winx64_struct1 var1,
4174 winx64_struct1 var2,
4175 winx64_struct1 var3,
4176 winx64_struct1 var4,
4177 winx64_struct1 var5)
4193 LIBTEST_API int STDCALL
4194 mono_test_Winx64_structs_in3 (winx64_struct1 var1,
4195 winx64_struct5 var2,
4196 winx64_struct1 var3,
4197 winx64_struct5 var4,
4198 winx64_struct1 var5,
4199 winx64_struct5 var6)
4234 LIBTEST_API winx64_struct1 STDCALL
4235 mono_test_Winx64_struct1_ret (void)
4242 LIBTEST_API winx64_struct2 STDCALL
4243 mono_test_Winx64_struct2_ret (void)
4251 LIBTEST_API winx64_struct3 STDCALL
4252 mono_test_Winx64_struct3_ret (void)
4261 LIBTEST_API winx64_struct4 STDCALL
4262 mono_test_Winx64_struct4_ret (void)
4272 LIBTEST_API winx64_struct5 STDCALL
4273 mono_test_Winx64_struct5_ret (void)
4282 LIBTEST_API winx64_struct1 STDCALL
4283 mono_test_Winx64_struct1_ret_5_args (char a, char b, char c, char d, char e)
4286 ret.a = a + b + c + d + e;
4290 LIBTEST_API winx64_struct5 STDCALL
4291 mono_test_Winx64_struct5_ret6_args (char a, char b, char c, char d, char e)
4304 } winx64_floatStruct;
4306 LIBTEST_API int STDCALL
4307 mono_test_Winx64_floatStruct (winx64_floatStruct a)
4309 if (a.a > 5.6 || a.a < 5.4)
4312 if (a.b > 9.6 || a.b < 9.4)
4321 } winx64_doubleStruct;
4323 LIBTEST_API int STDCALL
4324 mono_test_Winx64_doubleStruct (winx64_doubleStruct a)
4326 if (a.a > 5.6 || a.a < 5.4)
4332 typedef int (STDCALL *managed_struct1_delegate) (winx64_struct1 a);
4334 LIBTEST_API int STDCALL
4335 mono_test_managed_Winx64_struct1_in(managed_struct1_delegate func)
4342 typedef int (STDCALL *managed_struct5_delegate) (winx64_struct5 a);
4344 LIBTEST_API int STDCALL
4345 mono_test_managed_Winx64_struct5_in(managed_struct5_delegate func)
4354 typedef int (STDCALL *managed_struct1_struct5_delegate) (winx64_struct1 a, winx64_struct5 b,
4355 winx64_struct1 c, winx64_struct5 d,
4356 winx64_struct1 e, winx64_struct5 f);
4358 LIBTEST_API int STDCALL
4359 mono_test_managed_Winx64_struct1_struct5_in(managed_struct1_struct5_delegate func)
4361 winx64_struct1 a, c, e;
4362 winx64_struct5 b, d, f;
4364 b.a = 2; b.b = 3; b.c = 4;
4366 d.a = 6; d.b = 7; d.c = 8;
4368 f.a = 10; f.b = 11; f.c = 12;
4370 return func (a, b, c, d, e, f);
4373 typedef winx64_struct1 (STDCALL *managed_struct1_ret_delegate) (void);
4375 LIBTEST_API int STDCALL
4376 mono_test_Winx64_struct1_ret_managed (managed_struct1_ret_delegate func)
4388 typedef winx64_struct5 (STDCALL *managed_struct5_ret_delegate) (void);
4390 LIBTEST_API int STDCALL
4391 mono_test_Winx64_struct5_ret_managed (managed_struct5_ret_delegate func)
4407 LIBTEST_API int STDCALL
4408 mono_test_marshal_bool_in (int arg, unsigned int expected, unsigned int bDefaultMarsh, unsigned int bBoolCustMarsh,
4409 char bI1CustMarsh, unsigned char bU1CustMarsh, short bVBCustMarsh)
4413 if (bDefaultMarsh != expected)
4417 if (bBoolCustMarsh != expected)
4421 if (bI1CustMarsh != expected)
4425 if (bU1CustMarsh != expected)
4429 if (bVBCustMarsh != expected)
4438 LIBTEST_API int STDCALL
4439 mono_test_marshal_bool_out (int arg, unsigned int testVal, unsigned int* bDefaultMarsh, unsigned int* bBoolCustMarsh,
4440 char* bI1CustMarsh, unsigned char* bU1CustMarsh, unsigned short* bVBCustMarsh)
4446 *bDefaultMarsh = testVal;
4449 if (!bBoolCustMarsh)
4451 *bBoolCustMarsh = testVal;
4456 *bI1CustMarsh = (char)testVal;
4461 *bU1CustMarsh = (unsigned char)testVal;
4466 *bVBCustMarsh = (unsigned short)testVal;
4474 LIBTEST_API int STDCALL
4475 mono_test_marshal_bool_ref (int arg, unsigned int expected, unsigned int testVal, unsigned int* bDefaultMarsh,
4476 unsigned int* bBoolCustMarsh, char* bI1CustMarsh, unsigned char* bU1CustMarsh,
4477 unsigned short* bVBCustMarsh)
4483 if (*bDefaultMarsh != expected)
4485 *bDefaultMarsh = testVal;
4488 if (!bBoolCustMarsh)
4490 if (*bBoolCustMarsh != expected)
4492 *bBoolCustMarsh = testVal;
4497 if (*bI1CustMarsh != expected)
4499 *bI1CustMarsh = (char)testVal;
4504 if (*bU1CustMarsh != expected)
4506 *bU1CustMarsh = (unsigned char)testVal;
4511 if (*bVBCustMarsh != expected)
4513 *bVBCustMarsh = (unsigned short)testVal;
4522 typedef int (STDCALL *MarshalBoolInDelegate) (int arg, unsigned int expected, unsigned int bDefaultMarsh,
4523 unsigned int bBoolCustMarsh, char bI1CustMarsh, unsigned char bU1CustMarsh, unsigned short bVBCustMarsh);
4525 LIBTEST_API int STDCALL
4526 mono_test_managed_marshal_bool_in (int arg, unsigned int expected, unsigned int testVal, MarshalBoolInDelegate pfcn)
4533 return pfcn (arg, expected, testVal, 0, 0, 0, 0);
4535 return pfcn (arg, expected, 0, testVal, 0, 0, 0);
4537 return pfcn (arg, expected, 0, 0, testVal, 0, 0);
4539 return pfcn (arg, expected, 0, 0, 0, testVal, 0);
4541 return pfcn (arg, expected, 0, 0, 0, 0, testVal);
4549 typedef int (STDCALL *MarshalBoolOutDelegate) (int arg, unsigned int expected, unsigned int* bDefaultMarsh,
4550 unsigned int* bBoolCustMarsh, char* bI1CustMarsh, unsigned char* bU1CustMarsh, unsigned short* bVBCustMarsh);
4552 LIBTEST_API int STDCALL
4553 mono_test_managed_marshal_bool_out (int arg, unsigned int expected, unsigned int testVal, MarshalBoolOutDelegate pfcn)
4556 unsigned int lDefaultMarsh, lBoolCustMarsh;
4557 char lI1CustMarsh = 0;
4558 unsigned char lU1CustMarsh = 0;
4559 unsigned short lVBCustMarsh = 0;
4560 lDefaultMarsh = lBoolCustMarsh = 0;
4567 unsigned int ltVal = 0;
4568 ret = pfcn (arg, testVal, <Val, &lBoolCustMarsh, &lI1CustMarsh, &lU1CustMarsh, &lVBCustMarsh);
4570 return 0x0100 + ret;
4571 if (expected != ltVal)
4576 unsigned int ltVal = 0;
4577 ret = pfcn (arg, testVal, &lDefaultMarsh, <Val, &lI1CustMarsh, &lU1CustMarsh, &lVBCustMarsh);
4579 return 0x0300 + ret;
4580 if (expected != ltVal)
4586 ret = pfcn (arg, testVal, &lDefaultMarsh, &lBoolCustMarsh, <Val, &lU1CustMarsh, &lVBCustMarsh);
4588 return 0x0500 + ret;
4589 if (expected != ltVal)
4594 unsigned char ltVal = 0;
4595 ret = pfcn (arg, testVal, &lDefaultMarsh, &lBoolCustMarsh, &lI1CustMarsh, <Val, &lVBCustMarsh);
4597 return 0x0700 + ret;
4598 if (expected != ltVal)
4603 unsigned short ltVal = 0;
4604 ret = pfcn (arg, testVal, &lDefaultMarsh, &lBoolCustMarsh, &lI1CustMarsh, &lU1CustMarsh, <Val);
4606 return 0x0900 + ret;
4607 if (expected != ltVal)
4618 typedef int (STDCALL *MarshalBoolRefDelegate) (int arg, unsigned int expected, unsigned int testVal, unsigned int* bDefaultMarsh,
4619 unsigned int* bBoolCustMarsh, char* bI1CustMarsh, unsigned char* bU1CustMarsh, unsigned short* bVBCustMarsh);
4621 LIBTEST_API int STDCALL
4622 mono_test_managed_marshal_bool_ref (int arg, unsigned int expected, unsigned int testVal, unsigned int outExpected,
4623 unsigned int outTestVal, MarshalBoolRefDelegate pfcn)
4626 unsigned int lDefaultMarsh, lBoolCustMarsh;
4627 char lI1CustMarsh = 0;
4628 unsigned char lU1CustMarsh = 0;
4629 unsigned short lVBCustMarsh = 0;
4630 lDefaultMarsh = lBoolCustMarsh = 0;
4638 unsigned int ltestVal = testVal;
4639 ret = pfcn (arg, expected, outTestVal, <estVal, &lBoolCustMarsh, &lI1CustMarsh, &lU1CustMarsh, &lVBCustMarsh);
4641 return 0x0100 + ret;
4642 if (outExpected != ltestVal)
4648 unsigned int ltestVal = testVal;
4649 ret = pfcn (arg, expected, outTestVal, &lDefaultMarsh, <estVal, &lI1CustMarsh, &lU1CustMarsh, &lVBCustMarsh);
4651 return 0x0300 + ret;
4652 if (outExpected != ltestVal)
4658 char ltestVal = testVal;
4659 ret = pfcn (arg, expected, outTestVal, &lDefaultMarsh, &lBoolCustMarsh, <estVal, &lU1CustMarsh, &lVBCustMarsh);
4661 return 0x0500 + ret;
4662 if (outExpected != ltestVal)
4668 unsigned char ltestVal = testVal;
4669 ret = pfcn (arg, expected, outTestVal, &lDefaultMarsh, &lBoolCustMarsh, &lI1CustMarsh, <estVal, &lVBCustMarsh);
4671 return 0x0700 + ret;
4672 if (outExpected != ltestVal)
4678 unsigned short ltestVal = testVal;
4679 ret = pfcn (arg, expected, outTestVal, &lDefaultMarsh, &lBoolCustMarsh, &lI1CustMarsh, &lU1CustMarsh, <estVal);
4681 return 0x0900 + ret;
4682 if (outExpected != ltestVal)
4695 LIBTEST_API int STDCALL
4696 mono_test_marshal_safearray_out_1dim_vt_bstr_empty (SAFEARRAY** safearray)
4698 /* Create an empty one-dimensional array of variants */
4700 SAFEARRAYBOUND dimensions [1];
4702 dimensions [0].lLbound = 0;
4703 dimensions [0].cElements = 0;
4705 pSA= SafeArrayCreate (VT_VARIANT, 1, dimensions);
4710 LIBTEST_API int STDCALL
4711 mono_test_marshal_safearray_out_1dim_vt_bstr (SAFEARRAY** safearray)
4713 /* Create a one-dimensional array of 10 variants filled with "0" to "9" */
4715 SAFEARRAYBOUND dimensions [1];
4721 dimensions [0].lLbound = 0;
4722 dimensions [0].cElements = 10;
4724 pSA= SafeArrayCreate (VT_VARIANT, 1, dimensions);
4725 for (i= dimensions [0].lLbound; i< (dimensions [0].cElements + dimensions [0].lLbound); i++) {
4727 VariantInit (&vOut);
4729 _ltoa (i,buffer,10);
4730 vOut.bstrVal= marshal_bstr_alloc (buffer);
4732 if ((hr = SafeArrayPutElement (pSA, indices, &vOut)) != S_OK) {
4733 VariantClear (&vOut);
4734 SafeArrayDestroy (pSA);
4737 VariantClear (&vOut);
4743 LIBTEST_API int STDCALL
4744 mono_test_marshal_safearray_out_2dim_vt_i4 (SAFEARRAY** safearray)
4746 /* Create a two-dimensional array of 4x3 variants filled with 11, 12, 13, etc. */
4748 SAFEARRAYBOUND dimensions [2];
4753 dimensions [0].lLbound = 0;
4754 dimensions [0].cElements = 4;
4755 dimensions [1].lLbound = 0;
4756 dimensions [1].cElements = 3;
4758 pSA= SafeArrayCreate(VT_VARIANT, 2, dimensions);
4759 for (i= dimensions [0].lLbound; i< (dimensions [0].cElements + dimensions [0].lLbound); i++) {
4760 for (j= dimensions [1].lLbound; j< (dimensions [1].cElements + dimensions [1].lLbound); j++) {
4762 VariantInit (&vOut);
4764 vOut.lVal = (i+1)*10+(j+1);
4767 if ((hr = SafeArrayPutElement (pSA, indices, &vOut)) != S_OK) {
4768 VariantClear (&vOut);
4769 SafeArrayDestroy (pSA);
4772 VariantClear (&vOut); // does a deep destroy of source VARIANT
4779 LIBTEST_API int STDCALL
4780 mono_test_marshal_safearray_out_4dim_vt_i4 (SAFEARRAY** safearray)
4782 /* Create a four-dimensional array of 10x3x6x7 variants filled with their indices */
4783 /* Also use non zero lower bounds */
4785 SAFEARRAYBOUND dimensions [4];
4790 dimensions [0].lLbound = 15;
4791 dimensions [0].cElements = 10;
4792 dimensions [1].lLbound = 20;
4793 dimensions [1].cElements = 3;
4794 dimensions [2].lLbound = 5;
4795 dimensions [2].cElements = 6;
4796 dimensions [3].lLbound = 12;
4797 dimensions [3].cElements = 7;
4799 pSA= SafeArrayCreate (VT_VARIANT, 4, dimensions);
4801 SafeArrayAccessData (pSA, (void **)&pData);
4803 for (i= 0; i< 10*3*6*7; i++) {
4804 VariantInit(&pData [i]);
4805 pData [i].vt = VT_I4;
4808 SafeArrayUnaccessData (pSA);
4813 LIBTEST_API int STDCALL
4814 mono_test_marshal_safearray_in_byval_1dim_empty (SAFEARRAY* safearray)
4816 /* Check that array is one dimensional and empty */
4819 long lbound, ubound;
4821 dim = SafeArrayGetDim (safearray);
4825 SafeArrayGetLBound (safearray, 1, &lbound);
4826 SafeArrayGetUBound (safearray, 1, &ubound);
4828 if ((lbound > 0) || (ubound > 0))
4834 LIBTEST_API int STDCALL
4835 mono_test_marshal_safearray_in_byval_1dim_vt_i4 (SAFEARRAY* safearray)
4837 /* Check that array is one dimensional containing integers from 1 to 10 */
4840 long lbound, ubound;
4845 dim = SafeArrayGetDim (safearray);
4849 SafeArrayGetLBound (safearray, 1, &lbound);
4850 SafeArrayGetUBound (safearray, 1, &ubound);
4852 if ((lbound != 0) || (ubound != 9))
4855 SafeArrayAccessData (safearray, (void **)&pData);
4856 for (i= lbound; i <= ubound; i++) {
4857 if ((VariantChangeType (&pData [i], &pData [i], VARIANT_NOUSEROVERRIDE, VT_I4) != S_OK) || (pData [i].lVal != i + 1))
4860 SafeArrayUnaccessData (safearray);
4865 LIBTEST_API int STDCALL
4866 mono_test_marshal_safearray_in_byval_1dim_vt_mixed (SAFEARRAY* safearray)
4868 /* Check that array is one dimensional containing integers mixed with strings from 0 to 12 */
4871 long lbound, ubound;
4878 VariantInit (&element);
4880 dim = SafeArrayGetDim (safearray);
4884 SafeArrayGetLBound (safearray, 1, &lbound);
4885 SafeArrayGetUBound (safearray, 1, &ubound);
4887 if ((lbound != 0) || (ubound != 12))
4890 SafeArrayAccessData (safearray, (void **)&pData);
4891 for (i= lbound; i <= ubound; i++) {
4892 if ((i%2 == 0) && (pData [i].vt != VT_I4))
4894 if ((i%2 == 1) && (pData [i].vt != VT_BSTR))
4896 if ((VariantChangeType (&pData [i], &pData [i], VARIANT_NOUSEROVERRIDE, VT_I4) != S_OK) || (pData [i].lVal != i))
4899 SafeArrayUnaccessData (safearray);
4901 /* Change the first element of the array to verify that [in] parameters are not marshalled back to the managed side */
4906 SafeArrayPutElement (safearray, indices, &element);
4907 VariantClear (&element);
4912 LIBTEST_API int STDCALL
4913 mono_test_marshal_safearray_in_byval_2dim_vt_i4 (SAFEARRAY* safearray)
4915 /* Check that array is one dimensional containing integers mixed with strings from 0 to 12 */
4918 long lbound1, ubound1, lbound2, ubound2;
4923 VariantInit (&element);
4925 dim = SafeArrayGetDim (safearray);
4929 SafeArrayGetLBound (safearray, 1, &lbound1);
4930 SafeArrayGetUBound (safearray, 1, &ubound1);
4932 if ((lbound1 != 0) || (ubound1 != 1))
4935 SafeArrayGetLBound (safearray, 2, &lbound2);
4936 SafeArrayGetUBound (safearray, 2, &ubound2);
4938 if ((lbound2 != 0) || (ubound2 != 3)) {
4942 for (i= lbound1; i <= ubound1; i++) {
4944 for (j= lbound2; j <= ubound2; j++) {
4946 if (SafeArrayGetElement (safearray, indices, &element) != S_OK)
4948 failed = ((element.vt != VT_I4) || (element.lVal != 10*(i+1)+(j+1)));
4949 VariantClear (&element);
4955 /* Change the first element of the array to verify that [in] parameters are not marshalled back to the managed side */
4961 SafeArrayPutElement (safearray, indices, &element);
4962 VariantClear (&element);
4967 LIBTEST_API int STDCALL
4968 mono_test_marshal_safearray_in_byval_3dim_vt_bstr (SAFEARRAY* safearray)
4970 /* Check that array is one dimensional containing integers mixed with strings from 0 to 12 */
4973 long lbound1, ubound1, lbound2, ubound2, lbound3, ubound3;
4974 long i, j, k, failed;
4978 VariantInit (&element);
4980 dim = SafeArrayGetDim (safearray);
4984 SafeArrayGetLBound (safearray, 1, &lbound1);
4985 SafeArrayGetUBound (safearray, 1, &ubound1);
4987 if ((lbound1 != 0) || (ubound1 != 1))
4990 SafeArrayGetLBound (safearray, 2, &lbound2);
4991 SafeArrayGetUBound (safearray, 2, &ubound2);
4993 if ((lbound2 != 0) || (ubound2 != 1))
4996 SafeArrayGetLBound (safearray, 3, &lbound3);
4997 SafeArrayGetUBound (safearray, 3, &ubound3);
4999 if ((lbound3 != 0) || (ubound3 != 2))
5002 for (i= lbound1; i <= ubound1; i++) {
5004 for (j= lbound2; j <= ubound2; j++) {
5006 for (k= lbound3; k <= ubound3; k++) {
5008 if (SafeArrayGetElement (safearray, indices, &element) != S_OK)
5010 failed = ((element.vt != VT_BSTR)
5011 || (VariantChangeType (&element, &element, VARIANT_NOUSEROVERRIDE, VT_I4) != S_OK)
5012 || (element.lVal != 100*(i+1)+10*(j+1)+(k+1)));
5013 VariantClear (&element);
5020 /* Change the first element of the array to verify that [in] parameters are not marshalled back to the managed side */
5025 element.vt = VT_BSTR;
5026 element.bstrVal = SysAllocString(L"Should not be copied");
5027 SafeArrayPutElement (safearray, indices, &element);
5028 VariantClear (&element);
5033 LIBTEST_API int STDCALL
5034 mono_test_marshal_safearray_in_byref_3dim_vt_bstr (SAFEARRAY** safearray)
5036 return mono_test_marshal_safearray_in_byval_3dim_vt_bstr (*safearray);
5039 LIBTEST_API int STDCALL
5040 mono_test_marshal_safearray_in_out_byref_1dim_empty (SAFEARRAY** safearray)
5042 /* Check that the input array is what is expected and change it so the caller can check */
5043 /* correct marshalling back to managed code */
5046 long lbound, ubound;
5047 SAFEARRAYBOUND dimensions [1];
5049 wchar_t buffer [20];
5053 /* Check that in array is one dimensional and empty */
5055 dim = SafeArrayGetDim (*safearray);
5060 SafeArrayGetLBound (*safearray, 1, &lbound);
5061 SafeArrayGetUBound (*safearray, 1, &ubound);
5063 if ((lbound > 0) || (ubound > 0)) {
5067 /* Re-dimension the array and return a one-dimensional array of 8 variants filled with "0" to "7" */
5069 dimensions [0].lLbound = 0;
5070 dimensions [0].cElements = 8;
5072 hr = SafeArrayRedim (*safearray, dimensions);
5076 for (i= dimensions [0].lLbound; i< (dimensions [0].lLbound + dimensions [0].cElements); i++) {
5078 VariantInit (&vOut);
5080 _ltow (i,buffer,10);
5081 vOut.bstrVal = SysAllocString (buffer);
5083 if ((hr = SafeArrayPutElement (*safearray, indices, &vOut)) != S_OK) {
5084 VariantClear (&vOut);
5085 SafeArrayDestroy (*safearray);
5088 VariantClear (&vOut);
5093 LIBTEST_API int STDCALL
5094 mono_test_marshal_safearray_in_out_byref_3dim_vt_bstr (SAFEARRAY** safearray)
5096 /* Check that the input array is what is expected and change it so the caller can check */
5097 /* correct marshalling back to managed code */
5100 long lbound1, ubound1, lbound2, ubound2, lbound3, ubound3;
5101 SAFEARRAYBOUND dimensions [1];
5102 long i, j, k, failed;
5103 wchar_t buffer [20];
5108 VariantInit (&element);
5110 /* Check that in array is three dimensional and contains the expected values */
5112 dim = SafeArrayGetDim (*safearray);
5116 SafeArrayGetLBound (*safearray, 1, &lbound1);
5117 SafeArrayGetUBound (*safearray, 1, &ubound1);
5119 if ((lbound1 != 0) || (ubound1 != 1))
5122 SafeArrayGetLBound (*safearray, 2, &lbound2);
5123 SafeArrayGetUBound (*safearray, 2, &ubound2);
5125 if ((lbound2 != 0) || (ubound2 != 1))
5128 SafeArrayGetLBound (*safearray, 3, &lbound3);
5129 SafeArrayGetUBound (*safearray, 3, &ubound3);
5131 if ((lbound3 != 0) || (ubound3 != 2))
5134 for (i= lbound1; i <= ubound1; i++) {
5136 for (j= lbound2; j <= ubound2; j++) {
5138 for (k= lbound3; k <= ubound3; k++) {
5140 if (SafeArrayGetElement (*safearray, indices, &element) != S_OK)
5142 failed = ((element.vt != VT_BSTR)
5143 || (VariantChangeType (&element, &element, VARIANT_NOUSEROVERRIDE, VT_I4) != S_OK)
5144 || (element.lVal != 100*(i+1)+10*(j+1)+(k+1)));
5145 VariantClear (&element);
5152 hr = SafeArrayDestroy (*safearray);
5156 /* Return a new one-dimensional array of 8 variants filled with "0" to "7" */
5158 dimensions [0].lLbound = 0;
5159 dimensions [0].cElements = 8;
5161 *safearray = SafeArrayCreate (VT_VARIANT, 1, dimensions);
5163 for (i= dimensions [0].lLbound; i< (dimensions [0].lLbound + dimensions [0].cElements); i++) {
5165 VariantInit (&vOut);
5167 _ltow (i,buffer,10);
5168 vOut.bstrVal = SysAllocString (buffer);
5170 if ((hr = SafeArrayPutElement (*safearray, indices, &vOut)) != S_OK) {
5171 VariantClear (&vOut);
5172 SafeArrayDestroy (*safearray);
5175 VariantClear (&vOut);
5180 LIBTEST_API int STDCALL
5181 mono_test_marshal_safearray_in_out_byref_1dim_vt_i4 (SAFEARRAY** safearray)
5183 /* Check that the input array is what is expected and change it so the caller can check */
5184 /* correct marshalling back to managed code */
5187 long lbound1, ubound1;
5193 VariantInit (&element);
5195 /* Check that in array is one dimensional and contains the expected value */
5197 dim = SafeArrayGetDim (*safearray);
5201 SafeArrayGetLBound (*safearray, 1, &lbound1);
5202 SafeArrayGetUBound (*safearray, 1, &ubound1);
5205 if ((lbound1 != 0) || (ubound1 != 1))
5209 for (i= lbound1; i <= ubound1; i++) {
5211 if (SafeArrayGetElement (*safearray, indices, &element) != S_OK)
5213 failed = (element.vt != VT_I4) || (element.lVal != i+1);
5214 VariantClear (&element);
5219 /* Change one of the elements of the array to verify that [out] parameter is marshalled back to the managed side */
5224 SafeArrayPutElement (*safearray, indices, &element);
5225 VariantClear (&element);
5230 LIBTEST_API int STDCALL
5231 mono_test_marshal_safearray_in_out_byval_1dim_vt_i4 (SAFEARRAY* safearray)
5233 /* Check that the input array is what is expected and change it so the caller can check */
5234 /* correct marshalling back to managed code */
5237 long lbound1, ubound1;
5238 SAFEARRAYBOUND dimensions [1];
5244 VariantInit (&element);
5246 /* Check that in array is one dimensional and contains the expected value */
5248 dim = SafeArrayGetDim (safearray);
5252 SafeArrayGetLBound (safearray, 1, &lbound1);
5253 SafeArrayGetUBound (safearray, 1, &ubound1);
5255 if ((lbound1 != 0) || (ubound1 != 0))
5258 for (i= lbound1; i <= ubound1; i++) {
5260 if (SafeArrayGetElement (safearray, indices, &element) != S_OK)
5262 failed = (element.vt != VT_I4) || (element.lVal != i+1);
5263 VariantClear (&element);
5268 /* Change the array to verify how [out] parameter is marshalled back to the managed side */
5270 /* Redimension the array */
5271 dimensions [0].lLbound = lbound1;
5272 dimensions [0].cElements = 2;
5273 hr = SafeArrayRedim(safearray, dimensions);
5277 element.lVal = 12345;
5278 SafeArrayPutElement (safearray, indices, &element);
5279 VariantClear (&element);
5283 element.lVal = -12345;
5284 SafeArrayPutElement (safearray, indices, &element);
5285 VariantClear (&element);
5290 LIBTEST_API int STDCALL
5291 mono_test_marshal_safearray_in_out_byval_3dim_vt_bstr (SAFEARRAY* safearray)
5293 /* Check that the input array is what is expected and change it so the caller can check */
5294 /* correct marshalling back to managed code */
5297 long lbound1, ubound1, lbound2, ubound2, lbound3, ubound3;
5298 long i, j, k, failed;
5303 VariantInit (&element);
5305 /* Check that in array is three dimensional and contains the expected values */
5307 dim = SafeArrayGetDim (safearray);
5311 SafeArrayGetLBound (safearray, 1, &lbound1);
5312 SafeArrayGetUBound (safearray, 1, &ubound1);
5314 if ((lbound1 != 0) || (ubound1 != 1))
5317 SafeArrayGetLBound (safearray, 2, &lbound2);
5318 SafeArrayGetUBound (safearray, 2, &ubound2);
5320 if ((lbound2 != 0) || (ubound2 != 1))
5323 SafeArrayGetLBound (safearray, 3, &lbound3);
5324 SafeArrayGetUBound (safearray, 3, &ubound3);
5326 if ((lbound3 != 0) || (ubound3 != 2))
5329 for (i= lbound1; i <= ubound1; i++) {
5331 for (j= lbound2; j <= ubound2; j++) {
5333 for (k= lbound3; k <= ubound3; k++) {
5335 if (SafeArrayGetElement (safearray, indices, &element) != S_OK)
5337 failed = ((element.vt != VT_BSTR)
5338 || (VariantChangeType (&element, &element, VARIANT_NOUSEROVERRIDE, VT_I4) != S_OK)
5339 || (element.lVal != 100*(i+1)+10*(j+1)+(k+1)));
5340 VariantClear (&element);
5347 /* Change the elements of the array to verify that [out] parameter is marshalled back to the managed side */
5354 SafeArrayPutElement (safearray, indices, &element);
5355 VariantClear (&element);
5362 SafeArrayPutElement (safearray, indices, &element);
5363 VariantClear (&element);
5368 element.vt = VT_BSTR;
5369 element.bstrVal = marshal_bstr_alloc("ABCDEFG");
5370 SafeArrayPutElement (safearray, indices, &element);
5371 VariantClear (&element);
5376 LIBTEST_API int STDCALL
5377 mono_test_marshal_safearray_mixed(
5378 SAFEARRAY *safearray1,
5379 SAFEARRAY **safearray2,
5380 SAFEARRAY *safearray3,
5381 SAFEARRAY **safearray4
5386 /* Initialize out parameters */
5389 /* array1: Check that in array is one dimensional and contains the expected value */
5390 hr = mono_test_marshal_safearray_in_out_byval_1dim_vt_i4 (safearray1);
5392 /* array2: Fill in with some values to check on the managed side */
5394 hr = mono_test_marshal_safearray_out_1dim_vt_bstr (safearray2);
5396 /* array3: Check that in array is one dimensional and contains the expected value */
5398 hr = mono_test_marshal_safearray_in_byval_1dim_vt_mixed(safearray3);
5400 /* array4: Check input values and fill in with some values to check on the managed side */
5402 hr = mono_test_marshal_safearray_in_out_byref_3dim_vt_bstr(safearray4);
5409 static int call_managed_res;
5412 call_managed (gpointer arg)
5414 SimpleDelegate del = (SimpleDelegate)arg;
5416 call_managed_res = del (42);
5419 LIBTEST_API int STDCALL
5420 mono_test_marshal_thread_attach (SimpleDelegate del)
5428 res = pthread_create (&t, NULL, (gpointer (*)(gpointer))call_managed, del);
5429 g_assert (res == 0);
5430 pthread_join (t, NULL);
5432 return call_managed_res;
5436 typedef int (STDCALL *Callback) (void);
5438 static Callback callback;
5440 LIBTEST_API void STDCALL
5441 mono_test_marshal_set_callback (Callback cb)
5446 LIBTEST_API int STDCALL
5447 mono_test_marshal_call_callback (void)
5452 LIBTEST_API int STDCALL
5453 mono_test_marshal_lpstr (char *str)
5455 return strcmp ("ABC", str);
5458 LIBTEST_API int STDCALL
5459 mono_test_marshal_lpwstr (gunichar2 *str)
5464 s = g_utf16_to_utf8 (str, -1, NULL, NULL, NULL);
5465 res = strcmp ("ABC", s);
5471 LIBTEST_API char* STDCALL
5472 mono_test_marshal_return_lpstr (void)
5474 char *res = (char *)marshal_alloc (4);
5475 strcpy (res, "XYZ");
5480 LIBTEST_API gunichar2* STDCALL
5481 mono_test_marshal_return_lpwstr (void)
5483 gunichar2 *res = (gunichar2 *)marshal_alloc (8);
5484 gunichar2* tmp = g_utf8_to_utf16 ("XYZ", -1, NULL, NULL, NULL);
5486 memcpy (res, tmp, 8);
5494 } SingleDoubleStruct;
5496 LIBTEST_API SingleDoubleStruct STDCALL
5497 mono_test_marshal_return_single_double_struct (void)
5499 SingleDoubleStruct res;
5509 LIBTEST_API int STDCALL
5510 mono_test_has_thiscall (void)
5516 _mono_test_native_thiscall1 (int arg)
5522 _mono_test_native_thiscall2 (int arg, int arg2)
5524 return arg + (arg2^1);
5528 _mono_test_native_thiscall3 (int arg, int arg2, int arg3)
5530 return arg + (arg2^1) + (arg3^2);
5533 #elif defined(__GNUC__)
5535 LIBTEST_API int STDCALL
5536 mono_test_has_thiscall (void)
5541 #define def_asm_fn(name) \
5543 "\t.globl _" #name "\n" \
5545 "\t.globl __" #name "\n" \
5550 def_asm_fn(mono_test_native_thiscall1)
5551 "\tmovl %ecx,%eax\n"
5554 def_asm_fn(mono_test_native_thiscall2)
5555 "\tmovl %ecx,%eax\n"
5556 "\tmovl 4(%esp),%ecx\n"
5558 "\taddl %ecx,%eax\n"
5561 def_asm_fn(mono_test_native_thiscall3)
5562 "\tmovl %ecx,%eax\n"
5563 "\tmovl 4(%esp),%ecx\n"
5565 "\taddl %ecx,%eax\n"
5566 "\tmovl 8(%esp),%ecx\n"
5568 "\taddl %ecx,%eax\n"
5575 LIBTEST_API int STDCALL
5576 mono_test_has_thiscall (void)
5588 LIBTEST_API sbyte1 STDCALL
5589 mono_return_sbyte1 (sbyte1 s1, int addend) {
5591 fprintf(stderr, "mono_return_sbyte1 s1.f1: got %d but expected %d\n", s1.f1, 1);
5601 LIBTEST_API sbyte2 STDCALL
5602 mono_return_sbyte2 (sbyte2 s2, int addend) {
5604 fprintf(stderr, "mono_return_sbyte2 s2.f1: got %d but expected %d\n", s2.f1, 1);
5607 fprintf(stderr, "mono_return_sbyte2 s2.f2: got %d but expected %d\n", s2.f2, 2);
5609 s2.f1+=addend; s2.f2+=addend;
5617 LIBTEST_API sbyte3 STDCALL
5618 mono_return_sbyte3 (sbyte3 s3, int addend) {
5620 fprintf(stderr, "mono_return_sbyte3 s3.f1: got %d but expected %d\n", s3.f1, 1);
5623 fprintf(stderr, "mono_return_sbyte3 s3.f2: got %d but expected %d\n", s3.f2, 2);
5626 fprintf(stderr, "mono_return_sbyte3 s3.f3: got %d but expected %d\n", s3.f3, 3);
5628 s3.f1+=addend; s3.f2+=addend; s3.f3+=addend;
5636 LIBTEST_API sbyte4 STDCALL
5637 mono_return_sbyte4 (sbyte4 s4, int addend) {
5639 fprintf(stderr, "mono_return_sbyte4 s4.f1: got %d but expected %d\n", s4.f1, 1);
5642 fprintf(stderr, "mono_return_sbyte4 s4.f2: got %d but expected %d\n", s4.f2, 2);
5645 fprintf(stderr, "mono_return_sbyte4 s4.f3: got %d but expected %d\n", s4.f3, 3);
5648 fprintf(stderr, "mono_return_sbyte4 s4.f4: got %d but expected %d\n", s4.f4, 4);
5650 s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend;
5655 char f1,f2,f3,f4,f5;
5658 LIBTEST_API sbyte5 STDCALL
5659 mono_return_sbyte5 (sbyte5 s5, int addend) {
5661 fprintf(stderr, "mono_return_sbyte5 s5.f1: got %d but expected %d\n", s5.f1, 1);
5664 fprintf(stderr, "mono_return_sbyte5 s5.f2: got %d but expected %d\n", s5.f2, 2);
5667 fprintf(stderr, "mono_return_sbyte5 s5.f3: got %d but expected %d\n", s5.f3, 3);
5670 fprintf(stderr, "mono_return_sbyte5 s5.f4: got %d but expected %d\n", s5.f4, 4);
5673 fprintf(stderr, "mono_return_sbyte5 s5.f5: got %d but expected %d\n", s5.f5, 5);
5675 s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend;
5680 char f1,f2,f3,f4,f5,f6;
5683 LIBTEST_API sbyte6 STDCALL
5684 mono_return_sbyte6 (sbyte6 s6, int addend) {
5686 fprintf(stderr, "mono_return_sbyte6 s6.f1: got %d but expected %d\n", s6.f1, 1);
5689 fprintf(stderr, "mono_return_sbyte6 s6.f2: got %d but expected %d\n", s6.f2, 2);
5692 fprintf(stderr, "mono_return_sbyte6 s6.f3: got %d but expected %d\n", s6.f3, 3);
5695 fprintf(stderr, "mono_return_sbyte6 s6.f4: got %d but expected %d\n", s6.f4, 4);
5698 fprintf(stderr, "mono_return_sbyte6 s6.f5: got %d but expected %d\n", s6.f5, 5);
5701 fprintf(stderr, "mono_return_sbyte6 s6.f6: got %d but expected %d\n", s6.f6, 6);
5703 s6.f1+=addend; s6.f2+=addend; s6.f3+=addend; s6.f4+=addend; s6.f5+=addend; s6.f6+=addend;
5708 char f1,f2,f3,f4,f5,f6,f7;
5711 LIBTEST_API sbyte7 STDCALL
5712 mono_return_sbyte7 (sbyte7 s7, int addend) {
5714 fprintf(stderr, "mono_return_sbyte7 s7.f1: got %d but expected %d\n", s7.f1, 1);
5717 fprintf(stderr, "mono_return_sbyte7 s7.f2: got %d but expected %d\n", s7.f2, 2);
5720 fprintf(stderr, "mono_return_sbyte7 s7.f3: got %d but expected %d\n", s7.f3, 3);
5723 fprintf(stderr, "mono_return_sbyte7 s7.f4: got %d but expected %d\n", s7.f4, 4);
5726 fprintf(stderr, "mono_return_sbyte7 s7.f5: got %d but expected %d\n", s7.f5, 5);
5729 fprintf(stderr, "mono_return_sbyte7 s7.f6: got %d but expected %d\n", s7.f6, 6);
5732 fprintf(stderr, "mono_return_sbyte7 s7.f7: got %d but expected %d\n", s7.f7, 7);
5734 s7.f1+=addend; s7.f2+=addend; s7.f3+=addend; s7.f4+=addend; s7.f5+=addend; s7.f6+=addend; s7.f7+=addend;
5739 char f1,f2,f3,f4,f5,f6,f7,f8;
5742 LIBTEST_API sbyte8 STDCALL
5743 mono_return_sbyte8 (sbyte8 s8, int addend) {
5745 fprintf(stderr, "mono_return_sbyte8 s8.f1: got %d but expected %d\n", s8.f1, 1);
5748 fprintf(stderr, "mono_return_sbyte8 s8.f2: got %d but expected %d\n", s8.f2, 2);
5751 fprintf(stderr, "mono_return_sbyte8 s8.f3: got %d but expected %d\n", s8.f3, 3);
5754 fprintf(stderr, "mono_return_sbyte8 s8.f4: got %d but expected %d\n", s8.f4, 4);
5757 fprintf(stderr, "mono_return_sbyte8 s8.f5: got %d but expected %d\n", s8.f5, 5);
5760 fprintf(stderr, "mono_return_sbyte8 s8.f6: got %d but expected %d\n", s8.f6, 6);
5763 fprintf(stderr, "mono_return_sbyte8 s8.f7: got %d but expected %d\n", s8.f7, 7);
5766 fprintf(stderr, "mono_return_sbyte8 s8.f8: got %d but expected %d\n", s8.f8, 8);
5768 s8.f1+=addend; s8.f2+=addend; s8.f3+=addend; s8.f4+=addend; s8.f5+=addend; s8.f6+=addend; s8.f7+=addend; s8.f8+=addend;
5773 char f1,f2,f3,f4,f5,f6,f7,f8,f9;
5776 LIBTEST_API sbyte9 STDCALL
5777 mono_return_sbyte9 (sbyte9 s9, int addend) {
5779 fprintf(stderr, "mono_return_sbyte9 s9.f1: got %d but expected %d\n", s9.f1, 1);
5782 fprintf(stderr, "mono_return_sbyte9 s9.f2: got %d but expected %d\n", s9.f2, 2);
5785 fprintf(stderr, "mono_return_sbyte9 s9.f3: got %d but expected %d\n", s9.f3, 3);
5788 fprintf(stderr, "mono_return_sbyte9 s9.f4: got %d but expected %d\n", s9.f4, 4);
5791 fprintf(stderr, "mono_return_sbyte9 s9.f5: got %d but expected %d\n", s9.f5, 5);
5794 fprintf(stderr, "mono_return_sbyte9 s9.f6: got %d but expected %d\n", s9.f6, 6);
5797 fprintf(stderr, "mono_return_sbyte9 s9.f7: got %d but expected %d\n", s9.f7, 7);
5800 fprintf(stderr, "mono_return_sbyte9 s9.f8: got %d but expected %d\n", s9.f8, 8);
5803 fprintf(stderr, "mono_return_sbyte9 s9.f9: got %d but expected %d\n", s9.f9, 9);
5805 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;
5810 char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10;
5813 LIBTEST_API sbyte10 STDCALL
5814 mono_return_sbyte10 (sbyte10 s10, int addend) {
5816 fprintf(stderr, "mono_return_sbyte10 s10.f1: got %d but expected %d\n", s10.f1, 1);
5819 fprintf(stderr, "mono_return_sbyte10 s10.f2: got %d but expected %d\n", s10.f2, 2);
5822 fprintf(stderr, "mono_return_sbyte10 s10.f3: got %d but expected %d\n", s10.f3, 3);
5825 fprintf(stderr, "mono_return_sbyte10 s10.f4: got %d but expected %d\n", s10.f4, 4);
5828 fprintf(stderr, "mono_return_sbyte10 s10.f5: got %d but expected %d\n", s10.f5, 5);
5831 fprintf(stderr, "mono_return_sbyte10 s10.f6: got %d but expected %d\n", s10.f6, 6);
5834 fprintf(stderr, "mono_return_sbyte10 s10.f7: got %d but expected %d\n", s10.f7, 7);
5837 fprintf(stderr, "mono_return_sbyte10 s10.f8: got %d but expected %d\n", s10.f8, 8);
5840 fprintf(stderr, "mono_return_sbyte10 s10.f9: got %d but expected %d\n", s10.f9, 9);
5842 if (s10.f10 != 10) {
5843 fprintf(stderr, "mono_return_sbyte10 s10.f10: got %d but expected %d\n", s10.f10, 10);
5845 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;
5850 char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11;
5853 LIBTEST_API sbyte11 STDCALL
5854 mono_return_sbyte11 (sbyte11 s11, int addend) {
5856 fprintf(stderr, "mono_return_sbyte11 s11.f1: got %d but expected %d\n", s11.f1, 1);
5859 fprintf(stderr, "mono_return_sbyte11 s11.f2: got %d but expected %d\n", s11.f2, 2);
5862 fprintf(stderr, "mono_return_sbyte11 s11.f3: got %d but expected %d\n", s11.f3, 3);
5865 fprintf(stderr, "mono_return_sbyte11 s11.f4: got %d but expected %d\n", s11.f4, 4);
5868 fprintf(stderr, "mono_return_sbyte11 s11.f5: got %d but expected %d\n", s11.f5, 5);
5871 fprintf(stderr, "mono_return_sbyte11 s11.f6: got %d but expected %d\n", s11.f6, 6);
5874 fprintf(stderr, "mono_return_sbyte11 s11.f7: got %d but expected %d\n", s11.f7, 7);
5877 fprintf(stderr, "mono_return_sbyte11 s11.f8: got %d but expected %d\n", s11.f8, 8);
5880 fprintf(stderr, "mono_return_sbyte11 s11.f9: got %d but expected %d\n", s11.f9, 9);
5882 if (s11.f10 != 10) {
5883 fprintf(stderr, "mono_return_sbyte11 s11.f10: got %d but expected %d\n", s11.f10, 10);
5885 if (s11.f11 != 11) {
5886 fprintf(stderr, "mono_return_sbyte11 s11.f11: got %d but expected %d\n", s11.f11, 11);
5888 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;
5893 char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12;
5896 LIBTEST_API sbyte12 STDCALL
5897 mono_return_sbyte12 (sbyte12 s12, int addend) {
5899 fprintf(stderr, "mono_return_sbyte12 s12.f1: got %d but expected %d\n", s12.f1, 1);
5902 fprintf(stderr, "mono_return_sbyte12 s12.f2: got %d but expected %d\n", s12.f2, 2);
5905 fprintf(stderr, "mono_return_sbyte12 s12.f3: got %d but expected %d\n", s12.f3, 3);
5908 fprintf(stderr, "mono_return_sbyte12 s12.f4: got %d but expected %d\n", s12.f4, 4);
5911 fprintf(stderr, "mono_return_sbyte12 s12.f5: got %d but expected %d\n", s12.f5, 5);
5914 fprintf(stderr, "mono_return_sbyte12 s12.f6: got %d but expected %d\n", s12.f6, 6);
5917 fprintf(stderr, "mono_return_sbyte12 s12.f7: got %d but expected %d\n", s12.f7, 7);
5920 fprintf(stderr, "mono_return_sbyte12 s12.f8: got %d but expected %d\n", s12.f8, 8);
5923 fprintf(stderr, "mono_return_sbyte12 s12.f9: got %d but expected %d\n", s12.f9, 9);
5925 if (s12.f10 != 10) {
5926 fprintf(stderr, "mono_return_sbyte12 s12.f10: got %d but expected %d\n", s12.f10, 10);
5928 if (s12.f11 != 11) {
5929 fprintf(stderr, "mono_return_sbyte12 s12.f11: got %d but expected %d\n", s12.f11, 11);
5931 if (s12.f12 != 12) {
5932 fprintf(stderr, "mono_return_sbyte12 s12.f12: got %d but expected %d\n", s12.f12, 12);
5934 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;
5939 char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13;
5942 LIBTEST_API sbyte13 STDCALL
5943 mono_return_sbyte13 (sbyte13 s13, int addend) {
5945 fprintf(stderr, "mono_return_sbyte13 s13.f1: got %d but expected %d\n", s13.f1, 1);
5948 fprintf(stderr, "mono_return_sbyte13 s13.f2: got %d but expected %d\n", s13.f2, 2);
5951 fprintf(stderr, "mono_return_sbyte13 s13.f3: got %d but expected %d\n", s13.f3, 3);
5954 fprintf(stderr, "mono_return_sbyte13 s13.f4: got %d but expected %d\n", s13.f4, 4);
5957 fprintf(stderr, "mono_return_sbyte13 s13.f5: got %d but expected %d\n", s13.f5, 5);
5960 fprintf(stderr, "mono_return_sbyte13 s13.f6: got %d but expected %d\n", s13.f6, 6);
5963 fprintf(stderr, "mono_return_sbyte13 s13.f7: got %d but expected %d\n", s13.f7, 7);
5966 fprintf(stderr, "mono_return_sbyte13 s13.f8: got %d but expected %d\n", s13.f8, 8);
5969 fprintf(stderr, "mono_return_sbyte13 s13.f9: got %d but expected %d\n", s13.f9, 9);
5971 if (s13.f10 != 10) {
5972 fprintf(stderr, "mono_return_sbyte13 s13.f10: got %d but expected %d\n", s13.f10, 10);
5974 if (s13.f11 != 11) {
5975 fprintf(stderr, "mono_return_sbyte13 s13.f11: got %d but expected %d\n", s13.f11, 11);
5977 if (s13.f12 != 12) {
5978 fprintf(stderr, "mono_return_sbyte13 s13.f12: got %d but expected %d\n", s13.f12, 12);
5980 if (s13.f13 != 13) {
5981 fprintf(stderr, "mono_return_sbyte13 s13.f13: got %d but expected %d\n", s13.f13, 13);
5983 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;
5988 char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14;
5991 LIBTEST_API sbyte14 STDCALL
5992 mono_return_sbyte14 (sbyte14 s14, int addend) {
5994 fprintf(stderr, "mono_return_sbyte14 s14.f1: got %d but expected %d\n", s14.f1, 1);
5997 fprintf(stderr, "mono_return_sbyte14 s14.f2: got %d but expected %d\n", s14.f2, 2);
6000 fprintf(stderr, "mono_return_sbyte14 s14.f3: got %d but expected %d\n", s14.f3, 3);
6003 fprintf(stderr, "mono_return_sbyte14 s14.f4: got %d but expected %d\n", s14.f4, 4);
6006 fprintf(stderr, "mono_return_sbyte14 s14.f5: got %d but expected %d\n", s14.f5, 5);
6009 fprintf(stderr, "mono_return_sbyte14 s14.f6: got %d but expected %d\n", s14.f6, 6);
6012 fprintf(stderr, "mono_return_sbyte14 s14.f7: got %d but expected %d\n", s14.f7, 7);
6015 fprintf(stderr, "mono_return_sbyte14 s14.f8: got %d but expected %d\n", s14.f8, 8);
6018 fprintf(stderr, "mono_return_sbyte14 s14.f9: got %d but expected %d\n", s14.f9, 9);
6020 if (s14.f10 != 10) {
6021 fprintf(stderr, "mono_return_sbyte14 s14.f10: got %d but expected %d\n", s14.f10, 10);
6023 if (s14.f11 != 11) {
6024 fprintf(stderr, "mono_return_sbyte14 s14.f11: got %d but expected %d\n", s14.f11, 11);
6026 if (s14.f12 != 12) {
6027 fprintf(stderr, "mono_return_sbyte14 s14.f12: got %d but expected %d\n", s14.f12, 12);
6029 if (s14.f13 != 13) {
6030 fprintf(stderr, "mono_return_sbyte14 s14.f13: got %d but expected %d\n", s14.f13, 13);
6032 if (s14.f14 != 14) {
6033 fprintf(stderr, "mono_return_sbyte14 s14.f14: got %d but expected %d\n", s14.f14, 14);
6035 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;
6040 char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15;
6043 LIBTEST_API sbyte15 STDCALL
6044 mono_return_sbyte15 (sbyte15 s15, int addend) {
6046 fprintf(stderr, "mono_return_sbyte15 s15.f1: got %d but expected %d\n", s15.f1, 1);
6049 fprintf(stderr, "mono_return_sbyte15 s15.f2: got %d but expected %d\n", s15.f2, 2);
6052 fprintf(stderr, "mono_return_sbyte15 s15.f3: got %d but expected %d\n", s15.f3, 3);
6055 fprintf(stderr, "mono_return_sbyte15 s15.f4: got %d but expected %d\n", s15.f4, 4);
6058 fprintf(stderr, "mono_return_sbyte15 s15.f5: got %d but expected %d\n", s15.f5, 5);
6061 fprintf(stderr, "mono_return_sbyte15 s15.f6: got %d but expected %d\n", s15.f6, 6);
6064 fprintf(stderr, "mono_return_sbyte15 s15.f7: got %d but expected %d\n", s15.f7, 7);
6067 fprintf(stderr, "mono_return_sbyte15 s15.f8: got %d but expected %d\n", s15.f8, 8);
6070 fprintf(stderr, "mono_return_sbyte15 s15.f9: got %d but expected %d\n", s15.f9, 9);
6072 if (s15.f10 != 10) {
6073 fprintf(stderr, "mono_return_sbyte15 s15.f10: got %d but expected %d\n", s15.f10, 10);
6075 if (s15.f11 != 11) {
6076 fprintf(stderr, "mono_return_sbyte15 s15.f11: got %d but expected %d\n", s15.f11, 11);
6078 if (s15.f12 != 12) {
6079 fprintf(stderr, "mono_return_sbyte15 s15.f12: got %d but expected %d\n", s15.f12, 12);
6081 if (s15.f13 != 13) {
6082 fprintf(stderr, "mono_return_sbyte15 s15.f13: got %d but expected %d\n", s15.f13, 13);
6084 if (s15.f14 != 14) {
6085 fprintf(stderr, "mono_return_sbyte15 s15.f14: got %d but expected %d\n", s15.f14, 14);
6087 if (s15.f15 != 15) {
6088 fprintf(stderr, "mono_return_sbyte15 s15.f15: got %d but expected %d\n", s15.f15, 15);
6090 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;
6095 char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16;
6098 LIBTEST_API sbyte16 STDCALL
6099 mono_return_sbyte16 (sbyte16 s16, int addend) {
6101 fprintf(stderr, "mono_return_sbyte16 s16.f1: got %d but expected %d\n", s16.f1, 1);
6104 fprintf(stderr, "mono_return_sbyte16 s16.f2: got %d but expected %d\n", s16.f2, 2);
6107 fprintf(stderr, "mono_return_sbyte16 s16.f3: got %d but expected %d\n", s16.f3, 3);
6110 fprintf(stderr, "mono_return_sbyte16 s16.f4: got %d but expected %d\n", s16.f4, 4);
6113 fprintf(stderr, "mono_return_sbyte16 s16.f5: got %d but expected %d\n", s16.f5, 5);
6116 fprintf(stderr, "mono_return_sbyte16 s16.f6: got %d but expected %d\n", s16.f6, 6);
6119 fprintf(stderr, "mono_return_sbyte16 s16.f7: got %d but expected %d\n", s16.f7, 7);
6122 fprintf(stderr, "mono_return_sbyte16 s16.f8: got %d but expected %d\n", s16.f8, 8);
6125 fprintf(stderr, "mono_return_sbyte16 s16.f9: got %d but expected %d\n", s16.f9, 9);
6127 if (s16.f10 != 10) {
6128 fprintf(stderr, "mono_return_sbyte16 s16.f10: got %d but expected %d\n", s16.f10, 10);
6130 if (s16.f11 != 11) {
6131 fprintf(stderr, "mono_return_sbyte16 s16.f11: got %d but expected %d\n", s16.f11, 11);
6133 if (s16.f12 != 12) {
6134 fprintf(stderr, "mono_return_sbyte16 s16.f12: got %d but expected %d\n", s16.f12, 12);
6136 if (s16.f13 != 13) {
6137 fprintf(stderr, "mono_return_sbyte16 s16.f13: got %d but expected %d\n", s16.f13, 13);
6139 if (s16.f14 != 14) {
6140 fprintf(stderr, "mono_return_sbyte16 s16.f14: got %d but expected %d\n", s16.f14, 14);
6142 if (s16.f15 != 15) {
6143 fprintf(stderr, "mono_return_sbyte16 s16.f15: got %d but expected %d\n", s16.f15, 15);
6145 if (s16.f16 != 16) {
6146 fprintf(stderr, "mono_return_sbyte16 s16.f16: got %d but expected %d\n", s16.f16, 16);
6148 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;
6153 char f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17;
6156 LIBTEST_API sbyte17 STDCALL
6157 mono_return_sbyte17 (sbyte17 s17, int addend) {
6159 fprintf(stderr, "mono_return_sbyte17 s17.f1: got %d but expected %d\n", s17.f1, 1);
6162 fprintf(stderr, "mono_return_sbyte17 s17.f2: got %d but expected %d\n", s17.f2, 2);
6165 fprintf(stderr, "mono_return_sbyte17 s17.f3: got %d but expected %d\n", s17.f3, 3);
6168 fprintf(stderr, "mono_return_sbyte17 s17.f4: got %d but expected %d\n", s17.f4, 4);
6171 fprintf(stderr, "mono_return_sbyte17 s17.f5: got %d but expected %d\n", s17.f5, 5);
6174 fprintf(stderr, "mono_return_sbyte17 s17.f6: got %d but expected %d\n", s17.f6, 6);
6177 fprintf(stderr, "mono_return_sbyte17 s17.f7: got %d but expected %d\n", s17.f7, 7);
6180 fprintf(stderr, "mono_return_sbyte17 s17.f8: got %d but expected %d\n", s17.f8, 8);
6183 fprintf(stderr, "mono_return_sbyte17 s17.f9: got %d but expected %d\n", s17.f9, 9);
6185 if (s17.f10 != 10) {
6186 fprintf(stderr, "mono_return_sbyte17 s17.f10: got %d but expected %d\n", s17.f10, 10);
6188 if (s17.f11 != 11) {
6189 fprintf(stderr, "mono_return_sbyte17 s17.f11: got %d but expected %d\n", s17.f11, 11);
6191 if (s17.f12 != 12) {
6192 fprintf(stderr, "mono_return_sbyte17 s17.f12: got %d but expected %d\n", s17.f12, 12);
6194 if (s17.f13 != 13) {
6195 fprintf(stderr, "mono_return_sbyte17 s17.f13: got %d but expected %d\n", s17.f13, 13);
6197 if (s17.f14 != 14) {
6198 fprintf(stderr, "mono_return_sbyte17 s17.f14: got %d but expected %d\n", s17.f14, 14);
6200 if (s17.f15 != 15) {
6201 fprintf(stderr, "mono_return_sbyte17 s17.f15: got %d but expected %d\n", s17.f15, 15);
6203 if (s17.f16 != 16) {
6204 fprintf(stderr, "mono_return_sbyte17 s17.f16: got %d but expected %d\n", s17.f16, 16);
6206 if (s17.f17 != 17) {
6207 fprintf(stderr, "mono_return_sbyte17 s17.f17: got %d but expected %d\n", s17.f17, 17);
6209 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;
6217 char f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15;
6223 LIBTEST_API sbyte16_nested STDCALL
6224 mono_return_sbyte16_nested (sbyte16_nested sn16, int addend) {
6225 if (sn16.nested1.f1 != 1) {
6226 fprintf(stderr, "mono_return_sbyte16_nested sn16.nested1.f1: got %d but expected %d\n", sn16.nested1.f1, 1);
6229 fprintf(stderr, "mono_return_sbyte16_nested sn16.f2: got %d but expected %d\n", sn16.f2, 2);
6232 fprintf(stderr, "mono_return_sbyte16_nested sn16.f3: got %d but expected %d\n", sn16.f3, 3);
6235 fprintf(stderr, "mono_return_sbyte16_nested sn16.f4: got %d but expected %d\n", sn16.f4, 4);
6238 fprintf(stderr, "mono_return_sbyte16_nested sn16.f5: got %d but expected %d\n", sn16.f5, 5);
6241 fprintf(stderr, "mono_return_sbyte16_nested sn16.f6: got %d but expected %d\n", sn16.f6, 6);
6244 fprintf(stderr, "mono_return_sbyte16_nested sn16.f7: got %d but expected %d\n", sn16.f7, 7);
6247 fprintf(stderr, "mono_return_sbyte16_nested sn16.f8: got %d but expected %d\n", sn16.f8, 8);
6250 fprintf(stderr, "mono_return_sbyte16_nested sn16.f9: got %d but expected %d\n", sn16.f9, 9);
6252 if (sn16.f10 != 10) {
6253 fprintf(stderr, "mono_return_sbyte16_nested sn16.f10: got %d but expected %d\n", sn16.f10, 10);
6255 if (sn16.f11 != 11) {
6256 fprintf(stderr, "mono_return_sbyte16_nested sn16.f11: got %d but expected %d\n", sn16.f11, 11);
6258 if (sn16.f12 != 12) {
6259 fprintf(stderr, "mono_return_sbyte16_nested sn16.f12: got %d but expected %d\n", sn16.f12, 12);
6261 if (sn16.f13 != 13) {
6262 fprintf(stderr, "mono_return_sbyte16_nested sn16.f13: got %d but expected %d\n", sn16.f13, 13);
6264 if (sn16.f14 != 14) {
6265 fprintf(stderr, "mono_return_sbyte16_nested sn16.f14: got %d but expected %d\n", sn16.f14, 14);
6267 if (sn16.f15 != 15) {
6268 fprintf(stderr, "mono_return_sbyte16_nested sn16.f15: got %d but expected %d\n", sn16.f15, 15);
6270 if (sn16.nested2.f16 != 16) {
6271 fprintf(stderr, "mono_return_sbyte16_nested sn16.nested2.f16: got %d but expected %d\n", sn16.nested2.f16, 16);
6273 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;
6282 LIBTEST_API short1 STDCALL
6283 mono_return_short1 (short1 s1, int addend) {
6285 fprintf(stderr, "mono_return_short1 s1.f1: got %d but expected %d\n", s1.f1, 1);
6295 LIBTEST_API short2 STDCALL
6296 mono_return_short2 (short2 s2, int addend) {
6298 fprintf(stderr, "mono_return_short2 s2.f1: got %d but expected %d\n", s2.f1, 1);
6301 fprintf(stderr, "mono_return_short2 s2.f2: got %d but expected %d\n", s2.f2, 2);
6303 s2.f1+=addend; s2.f2+=addend;
6311 LIBTEST_API short3 STDCALL
6312 mono_return_short3 (short3 s3, int addend) {
6314 fprintf(stderr, "mono_return_short3 s3.f1: got %d but expected %d\n", s3.f1, 1);
6317 fprintf(stderr, "mono_return_short3 s3.f2: got %d but expected %d\n", s3.f2, 2);
6320 fprintf(stderr, "mono_return_short3 s3.f3: got %d but expected %d\n", s3.f3, 3);
6322 s3.f1+=addend; s3.f2+=addend; s3.f3+=addend;
6330 LIBTEST_API short4 STDCALL
6331 mono_return_short4 (short4 s4, int addend) {
6333 fprintf(stderr, "mono_return_short4 s4.f1: got %d but expected %d\n", s4.f1, 1);
6336 fprintf(stderr, "mono_return_short4 s4.f2: got %d but expected %d\n", s4.f2, 2);
6339 fprintf(stderr, "mono_return_short4 s4.f3: got %d but expected %d\n", s4.f3, 3);
6342 fprintf(stderr, "mono_return_short4 s4.f4: got %d but expected %d\n", s4.f4, 4);
6344 s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend;
6349 short f1,f2,f3,f4,f5;
6352 LIBTEST_API short5 STDCALL
6353 mono_return_short5 (short5 s5, int addend) {
6355 fprintf(stderr, "mono_return_short5 s5.f1: got %d but expected %d\n", s5.f1, 1);
6358 fprintf(stderr, "mono_return_short5 s5.f2: got %d but expected %d\n", s5.f2, 2);
6361 fprintf(stderr, "mono_return_short5 s5.f3: got %d but expected %d\n", s5.f3, 3);
6364 fprintf(stderr, "mono_return_short5 s5.f4: got %d but expected %d\n", s5.f4, 4);
6367 fprintf(stderr, "mono_return_short5 s5.f5: got %d but expected %d\n", s5.f5, 5);
6369 s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend;
6374 short f1,f2,f3,f4,f5,f6;
6377 LIBTEST_API short6 STDCALL
6378 mono_return_short6 (short6 s6, int addend) {
6380 fprintf(stderr, "mono_return_short6 s6.f1: got %d but expected %d\n", s6.f1, 1);
6383 fprintf(stderr, "mono_return_short6 s6.f2: got %d but expected %d\n", s6.f2, 2);
6386 fprintf(stderr, "mono_return_short6 s6.f3: got %d but expected %d\n", s6.f3, 3);
6389 fprintf(stderr, "mono_return_short6 s6.f4: got %d but expected %d\n", s6.f4, 4);
6392 fprintf(stderr, "mono_return_short6 s6.f5: got %d but expected %d\n", s6.f5, 5);
6395 fprintf(stderr, "mono_return_short6 s6.f6: got %d but expected %d\n", s6.f6, 6);
6397 s6.f1+=addend; s6.f2+=addend; s6.f3+=addend; s6.f4+=addend; s6.f5+=addend; s6.f6+=addend;
6402 short f1,f2,f3,f4,f5,f6,f7;
6405 LIBTEST_API short7 STDCALL
6406 mono_return_short7 (short7 s7, int addend) {
6408 fprintf(stderr, "mono_return_short7 s7.f1: got %d but expected %d\n", s7.f1, 1);
6411 fprintf(stderr, "mono_return_short7 s7.f2: got %d but expected %d\n", s7.f2, 2);
6414 fprintf(stderr, "mono_return_short7 s7.f3: got %d but expected %d\n", s7.f3, 3);
6417 fprintf(stderr, "mono_return_short7 s7.f4: got %d but expected %d\n", s7.f4, 4);
6420 fprintf(stderr, "mono_return_short7 s7.f5: got %d but expected %d\n", s7.f5, 5);
6423 fprintf(stderr, "mono_return_short7 s7.f6: got %d but expected %d\n", s7.f6, 6);
6426 fprintf(stderr, "mono_return_short7 s7.f7: got %d but expected %d\n", s7.f7, 7);
6428 s7.f1+=addend; s7.f2+=addend; s7.f3+=addend; s7.f4+=addend; s7.f5+=addend; s7.f6+=addend; s7.f7+=addend;
6433 short f1,f2,f3,f4,f5,f6,f7,f8;
6436 LIBTEST_API short8 STDCALL
6437 mono_return_short8 (short8 s8, int addend) {
6439 fprintf(stderr, "mono_return_short8 s8.f1: got %d but expected %d\n", s8.f1, 1);
6442 fprintf(stderr, "mono_return_short8 s8.f2: got %d but expected %d\n", s8.f2, 2);
6445 fprintf(stderr, "mono_return_short8 s8.f3: got %d but expected %d\n", s8.f3, 3);
6448 fprintf(stderr, "mono_return_short8 s8.f4: got %d but expected %d\n", s8.f4, 4);
6451 fprintf(stderr, "mono_return_short8 s8.f5: got %d but expected %d\n", s8.f5, 5);
6454 fprintf(stderr, "mono_return_short8 s8.f6: got %d but expected %d\n", s8.f6, 6);
6457 fprintf(stderr, "mono_return_short8 s8.f7: got %d but expected %d\n", s8.f7, 7);
6460 fprintf(stderr, "mono_return_short8 s8.f8: got %d but expected %d\n", s8.f8, 8);
6462 s8.f1+=addend; s8.f2+=addend; s8.f3+=addend; s8.f4+=addend; s8.f5+=addend; s8.f6+=addend; s8.f7+=addend; s8.f8+=addend;
6467 short f1,f2,f3,f4,f5,f6,f7,f8,f9;
6470 LIBTEST_API short9 STDCALL
6471 mono_return_short9 (short9 s9, int addend) {
6473 fprintf(stderr, "mono_return_short9 s9.f1: got %d but expected %d\n", s9.f1, 1);
6476 fprintf(stderr, "mono_return_short9 s9.f2: got %d but expected %d\n", s9.f2, 2);
6479 fprintf(stderr, "mono_return_short9 s9.f3: got %d but expected %d\n", s9.f3, 3);
6482 fprintf(stderr, "mono_return_short9 s9.f4: got %d but expected %d\n", s9.f4, 4);
6485 fprintf(stderr, "mono_return_short9 s9.f5: got %d but expected %d\n", s9.f5, 5);
6488 fprintf(stderr, "mono_return_short9 s9.f6: got %d but expected %d\n", s9.f6, 6);
6491 fprintf(stderr, "mono_return_short9 s9.f7: got %d but expected %d\n", s9.f7, 7);
6494 fprintf(stderr, "mono_return_short9 s9.f8: got %d but expected %d\n", s9.f8, 8);
6497 fprintf(stderr, "mono_return_short9 s9.f9: got %d but expected %d\n", s9.f9, 9);
6499 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;
6507 short f2,f3,f4,f5,f6,f7;
6513 LIBTEST_API short8_nested STDCALL
6514 mono_return_short8_nested (short8_nested sn8, int addend) {
6515 if (sn8.nested1.f1 != 1) {
6516 fprintf(stderr, "mono_return_short8_nested sn8.nested1.f1: got %d but expected %d\n", sn8.nested1.f1, 1);
6519 fprintf(stderr, "mono_return_short8_nested sn8.f2: got %d but expected %d\n", sn8.f2, 2);
6522 fprintf(stderr, "mono_return_short8_nested sn8.f3: got %d but expected %d\n", sn8.f3, 3);
6525 fprintf(stderr, "mono_return_short8_nested sn8.f4: got %d but expected %d\n", sn8.f4, 4);
6528 fprintf(stderr, "mono_return_short8_nested sn8.f5: got %d but expected %d\n", sn8.f5, 5);
6531 fprintf(stderr, "mono_return_short8_nested sn8.f6: got %d but expected %d\n", sn8.f6, 6);
6534 fprintf(stderr, "mono_return_short8_nested sn8.f7: got %d but expected %d\n", sn8.f7, 7);
6536 if (sn8.nested2.f8 != 8) {
6537 fprintf(stderr, "mono_return_short8_nested sn8.nested2.f8: got %d but expected %d\n", sn8.nested2.f8, 8);
6539 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;
6548 LIBTEST_API int1 STDCALL
6549 mono_return_int1 (int1 s1, int addend) {
6551 fprintf(stderr, "mono_return_int1 s1.f1: got %d but expected %d\n", s1.f1, 1);
6561 LIBTEST_API int2 STDCALL
6562 mono_return_int2 (int2 s2, int addend) {
6564 fprintf(stderr, "mono_return_int2 s2.f1: got %d but expected %d\n", s2.f1, 1);
6567 fprintf(stderr, "mono_return_int2 s2.f2: got %d but expected %d\n", s2.f2, 2);
6569 s2.f1+=addend; s2.f2+=addend;
6577 LIBTEST_API int3 STDCALL
6578 mono_return_int3 (int3 s3, int addend) {
6580 fprintf(stderr, "mono_return_int3 s3.f1: got %d but expected %d\n", s3.f1, 1);
6583 fprintf(stderr, "mono_return_int3 s3.f2: got %d but expected %d\n", s3.f2, 2);
6586 fprintf(stderr, "mono_return_int3 s3.f3: got %d but expected %d\n", s3.f3, 3);
6588 s3.f1+=addend; s3.f2+=addend; s3.f3+=addend;
6596 LIBTEST_API int4 STDCALL
6597 mono_return_int4 (int4 s4, int addend) {
6599 fprintf(stderr, "mono_return_int4 s4.f1: got %d but expected %d\n", s4.f1, 1);
6602 fprintf(stderr, "mono_return_int4 s4.f2: got %d but expected %d\n", s4.f2, 2);
6605 fprintf(stderr, "mono_return_int4 s4.f3: got %d but expected %d\n", s4.f3, 3);
6608 fprintf(stderr, "mono_return_int4 s4.f4: got %d but expected %d\n", s4.f4, 4);
6610 s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend;
6618 LIBTEST_API int5 STDCALL
6619 mono_return_int5 (int5 s5, int addend) {
6621 fprintf(stderr, "mono_return_int5 s5.f1: got %d but expected %d\n", s5.f1, 1);
6624 fprintf(stderr, "mono_return_int5 s5.f2: got %d but expected %d\n", s5.f2, 2);
6627 fprintf(stderr, "mono_return_int5 s5.f3: got %d but expected %d\n", s5.f3, 3);
6630 fprintf(stderr, "mono_return_int5 s5.f4: got %d but expected %d\n", s5.f4, 4);
6633 fprintf(stderr, "mono_return_int5 s5.f5: got %d but expected %d\n", s5.f5, 5);
6635 s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend;
6649 LIBTEST_API int4_nested STDCALL
6650 mono_return_int4_nested (int4_nested sn4, int addend) {
6651 if (sn4.nested1.f1 != 1) {
6652 fprintf(stderr, "mono_return_int4_nested sn4.nested1.f1: got %d but expected %d\n", sn4.nested1.f1, 1);
6655 fprintf(stderr, "mono_return_int4_nested sn4.f2: got %d but expected %d\n", sn4.f2, 2);
6658 fprintf(stderr, "mono_return_int4_nested sn4.f3: got %d but expected %d\n", sn4.f3, 3);
6660 if (sn4.nested2.f4 != 4) {
6661 fprintf(stderr, "mono_return_int4_nested sn4.nested2.f4: got %d but expected %d\n", sn4.nested2.f4, 4);
6663 sn4.nested1.f1+=addend; sn4.f2+=addend; sn4.f3+=addend; sn4.nested2.f4+=addend;
6671 LIBTEST_API float1 STDCALL
6672 mono_return_float1 (float1 s1, int addend) {
6674 fprintf(stderr, "mono_return_float1 s1.f1: got %f but expected %d\n", s1.f1, 1);
6684 LIBTEST_API float2 STDCALL
6685 mono_return_float2 (float2 s2, int addend) {
6687 fprintf(stderr, "mono_return_float2 s2.f1: got %f but expected %d\n", s2.f1, 1);
6690 fprintf(stderr, "mono_return_float2 s2.f2: got %f but expected %d\n", s2.f2, 2);
6692 s2.f1+=addend; s2.f2+=addend;
6700 LIBTEST_API float3 STDCALL
6701 mono_return_float3 (float3 s3, int addend) {
6703 fprintf(stderr, "mono_return_float3 s3.f1: got %f but expected %d\n", s3.f1, 1);
6706 fprintf(stderr, "mono_return_float3 s3.f2: got %f but expected %d\n", s3.f2, 2);
6709 fprintf(stderr, "mono_return_float3 s3.f3: got %f but expected %d\n", s3.f3, 3);
6711 s3.f1+=addend; s3.f2+=addend; s3.f3+=addend;
6719 LIBTEST_API float4 STDCALL
6720 mono_return_float4 (float4 s4, int addend) {
6722 fprintf(stderr, "mono_return_float4 s4.f1: got %f but expected %d\n", s4.f1, 1);
6725 fprintf(stderr, "mono_return_float4 s4.f2: got %f but expected %d\n", s4.f2, 2);
6728 fprintf(stderr, "mono_return_float4 s4.f3: got %f but expected %d\n", s4.f3, 3);
6731 fprintf(stderr, "mono_return_float4 s4.f4: got %f but expected %d\n", s4.f4, 4);
6733 s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend;
6738 float f1,f2,f3,f4,f5;
6741 LIBTEST_API float5 STDCALL
6742 mono_return_float5 (float5 s5, int addend) {
6744 fprintf(stderr, "mono_return_float5 s5.f1: got %f but expected %d\n", s5.f1, 1);
6747 fprintf(stderr, "mono_return_float5 s5.f2: got %f but expected %d\n", s5.f2, 2);
6750 fprintf(stderr, "mono_return_float5 s5.f3: got %f but expected %d\n", s5.f3, 3);
6753 fprintf(stderr, "mono_return_float5 s5.f4: got %f but expected %d\n", s5.f4, 4);
6756 fprintf(stderr, "mono_return_float5 s5.f5: got %f but expected %d\n", s5.f5, 5);
6758 s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend;
6763 float f1,f2,f3,f4,f5,f6;
6766 LIBTEST_API float6 STDCALL
6767 mono_return_float6 (float6 s6, int addend) {
6769 fprintf(stderr, "mono_return_float6 s6.f1: got %f but expected %d\n", s6.f1, 1);
6772 fprintf(stderr, "mono_return_float6 s6.f2: got %f but expected %d\n", s6.f2, 2);
6775 fprintf(stderr, "mono_return_float6 s6.f3: got %f but expected %d\n", s6.f3, 3);
6778 fprintf(stderr, "mono_return_float6 s6.f4: got %f but expected %d\n", s6.f4, 4);
6781 fprintf(stderr, "mono_return_float6 s6.f5: got %f but expected %d\n", s6.f5, 5);
6784 fprintf(stderr, "mono_return_float6 s6.f6: got %f but expected %d\n", s6.f6, 6);
6786 s6.f1+=addend; s6.f2+=addend; s6.f3+=addend; s6.f4+=addend; s6.f5+=addend; s6.f6+=addend;
6791 float f1,f2,f3,f4,f5,f6,f7;
6794 LIBTEST_API float7 STDCALL
6795 mono_return_float7 (float7 s7, int addend) {
6797 fprintf(stderr, "mono_return_float7 s7.f1: got %f but expected %d\n", s7.f1, 1);
6800 fprintf(stderr, "mono_return_float7 s7.f2: got %f but expected %d\n", s7.f2, 2);
6803 fprintf(stderr, "mono_return_float7 s7.f3: got %f but expected %d\n", s7.f3, 3);
6806 fprintf(stderr, "mono_return_float7 s7.f4: got %f but expected %d\n", s7.f4, 4);
6809 fprintf(stderr, "mono_return_float7 s7.f5: got %f but expected %d\n", s7.f5, 5);
6812 fprintf(stderr, "mono_return_float7 s7.f6: got %f but expected %d\n", s7.f6, 6);
6815 fprintf(stderr, "mono_return_float7 s7.f7: got %f but expected %d\n", s7.f7, 7);
6817 s7.f1+=addend; s7.f2+=addend; s7.f3+=addend; s7.f4+=addend; s7.f5+=addend; s7.f6+=addend; s7.f7+=addend;
6822 float f1,f2,f3,f4,f5,f6,f7,f8;
6825 LIBTEST_API float8 STDCALL
6826 mono_return_float8 (float8 s8, int addend) {
6828 fprintf(stderr, "mono_return_float8 s8.f1: got %f but expected %d\n", s8.f1, 1);
6831 fprintf(stderr, "mono_return_float8 s8.f2: got %f but expected %d\n", s8.f2, 2);
6834 fprintf(stderr, "mono_return_float8 s8.f3: got %f but expected %d\n", s8.f3, 3);
6837 fprintf(stderr, "mono_return_float8 s8.f4: got %f but expected %d\n", s8.f4, 4);
6840 fprintf(stderr, "mono_return_float8 s8.f5: got %f but expected %d\n", s8.f5, 5);
6843 fprintf(stderr, "mono_return_float8 s8.f6: got %f but expected %d\n", s8.f6, 6);
6846 fprintf(stderr, "mono_return_float8 s8.f7: got %f but expected %d\n", s8.f7, 7);
6849 fprintf(stderr, "mono_return_float8 s8.f8: got %f but expected %d\n", s8.f8, 8);
6851 s8.f1+=addend; s8.f2+=addend; s8.f3+=addend; s8.f4+=addend; s8.f5+=addend; s8.f6+=addend; s8.f7+=addend; s8.f8+=addend;
6856 float f1,f2,f3,f4,f5,f6,f7,f8,f9;
6859 LIBTEST_API float9 STDCALL
6860 mono_return_float9 (float9 s9, int addend) {
6862 fprintf(stderr, "mono_return_float9 s9.f1: got %f but expected %d\n", s9.f1, 1);
6865 fprintf(stderr, "mono_return_float9 s9.f2: got %f but expected %d\n", s9.f2, 2);
6868 fprintf(stderr, "mono_return_float9 s9.f3: got %f but expected %d\n", s9.f3, 3);
6871 fprintf(stderr, "mono_return_float9 s9.f4: got %f but expected %d\n", s9.f4, 4);
6874 fprintf(stderr, "mono_return_float9 s9.f5: got %f but expected %d\n", s9.f5, 5);
6877 fprintf(stderr, "mono_return_float9 s9.f6: got %f but expected %d\n", s9.f6, 6);
6880 fprintf(stderr, "mono_return_float9 s9.f7: got %f but expected %d\n", s9.f7, 7);
6883 fprintf(stderr, "mono_return_float9 s9.f8: got %f but expected %d\n", s9.f8, 8);
6886 fprintf(stderr, "mono_return_float9 s9.f9: got %f but expected %d\n", s9.f9, 9);
6888 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;
6902 LIBTEST_API float4_nested STDCALL
6903 mono_return_float4_nested (float4_nested sn4, int addend) {
6904 if (sn4.nested1.f1 != 1) {
6905 fprintf(stderr, "mono_return_float4_nested sn4.nested1.f1: got %f but expected %d\n", sn4.nested1.f1, 1);
6908 fprintf(stderr, "mono_return_float4_nested sn4.f2: got %f but expected %d\n", sn4.f2, 2);
6911 fprintf(stderr, "mono_return_float4_nested sn4.f3: got %f but expected %d\n", sn4.f3, 3);
6913 if (sn4.nested2.f4 != 4) {
6914 fprintf(stderr, "mono_return_float4_nested sn4.nested2.f4: got %f but expected %d\n", sn4.nested2.f4, 4);
6916 sn4.nested1.f1+=addend; sn4.f2+=addend; sn4.f3+=addend; sn4.nested2.f4+=addend;
6924 LIBTEST_API double1 STDCALL
6925 mono_return_double1 (double1 s1, int addend) {
6927 fprintf(stderr, "mono_return_double1 s1.f1: got %f but expected %d\n", s1.f1, 1);
6937 LIBTEST_API double2 STDCALL
6938 mono_return_double2 (double2 s2, int addend) {
6940 fprintf(stderr, "mono_return_double2 s2.f1: got %f but expected %d\n", s2.f1, 1);
6943 fprintf(stderr, "mono_return_double2 s2.f2: got %f but expected %d\n", s2.f2, 2);
6945 s2.f1+=addend; s2.f2+=addend;
6953 LIBTEST_API double3 STDCALL
6954 mono_return_double3 (double3 s3, int addend) {
6956 fprintf(stderr, "mono_return_double3 s3.f1: got %f but expected %d\n", s3.f1, 1);
6959 fprintf(stderr, "mono_return_double3 s3.f2: got %f but expected %d\n", s3.f2, 2);
6962 fprintf(stderr, "mono_return_double3 s3.f3: got %f but expected %d\n", s3.f3, 3);
6964 s3.f1+=addend; s3.f2+=addend; s3.f3+=addend;
6972 LIBTEST_API double4 STDCALL
6973 mono_return_double4 (double4 s4, int addend) {
6975 fprintf(stderr, "mono_return_double4 s4.f1: got %f but expected %d\n", s4.f1, 1);
6978 fprintf(stderr, "mono_return_double4 s4.f2: got %f but expected %d\n", s4.f2, 2);
6981 fprintf(stderr, "mono_return_double4 s4.f3: got %f but expected %d\n", s4.f3, 3);
6984 fprintf(stderr, "mono_return_double4 s4.f4: got %f but expected %d\n", s4.f4, 4);
6986 s4.f1+=addend; s4.f2+=addend; s4.f3+=addend; s4.f4+=addend;
6991 double f1,f2,f3,f4,f5;
6994 LIBTEST_API double5 STDCALL
6995 mono_return_double5 (double5 s5, int addend) {
6997 fprintf(stderr, "mono_return_double5 s5.f1: got %f but expected %d\n", s5.f1, 1);
7000 fprintf(stderr, "mono_return_double5 s5.f2: got %f but expected %d\n", s5.f2, 2);
7003 fprintf(stderr, "mono_return_double5 s5.f3: got %f but expected %d\n", s5.f3, 3);
7006 fprintf(stderr, "mono_return_double5 s5.f4: got %f but expected %d\n", s5.f4, 4);
7009 fprintf(stderr, "mono_return_double5 s5.f5: got %f but expected %d\n", s5.f5, 5);
7011 s5.f1+=addend; s5.f2+=addend; s5.f3+=addend; s5.f4+=addend; s5.f5+=addend;
7016 double f1,f2,f3,f4,f5,f6;
7019 LIBTEST_API double6 STDCALL
7020 mono_return_double6 (double6 s6, int addend) {
7022 fprintf(stderr, "mono_return_double6 s6.f1: got %f but expected %d\n", s6.f1, 1);
7025 fprintf(stderr, "mono_return_double6 s6.f2: got %f but expected %d\n", s6.f2, 2);
7028 fprintf(stderr, "mono_return_double6 s6.f3: got %f but expected %d\n", s6.f3, 3);
7031 fprintf(stderr, "mono_return_double6 s6.f4: got %f but expected %d\n", s6.f4, 4);
7034 fprintf(stderr, "mono_return_double6 s6.f5: got %f but expected %d\n", s6.f5, 5);
7037 fprintf(stderr, "mono_return_double6 s6.f6: got %f but expected %d\n", s6.f6, 6);
7039 s6.f1+=addend; s6.f2+=addend; s6.f3+=addend; s6.f4+=addend; s6.f5+=addend; s6.f6+=addend;
7044 double f1,f2,f3,f4,f5,f6,f7;
7047 LIBTEST_API double7 STDCALL
7048 mono_return_double7 (double7 s7, int addend) {
7050 fprintf(stderr, "mono_return_double7 s7.f1: got %f but expected %d\n", s7.f1, 1);
7053 fprintf(stderr, "mono_return_double7 s7.f2: got %f but expected %d\n", s7.f2, 2);
7056 fprintf(stderr, "mono_return_double7 s7.f3: got %f but expected %d\n", s7.f3, 3);
7059 fprintf(stderr, "mono_return_double7 s7.f4: got %f but expected %d\n", s7.f4, 4);
7062 fprintf(stderr, "mono_return_double7 s7.f5: got %f but expected %d\n", s7.f5, 5);
7065 fprintf(stderr, "mono_return_double7 s7.f6: got %f but expected %d\n", s7.f6, 6);
7068 fprintf(stderr, "mono_return_double7 s7.f7: got %f but expected %d\n", s7.f7, 7);
7070 s7.f1+=addend; s7.f2+=addend; s7.f3+=addend; s7.f4+=addend; s7.f5+=addend; s7.f6+=addend; s7.f7+=addend;
7075 double f1,f2,f3,f4,f5,f6,f7,f8;
7078 LIBTEST_API double8 STDCALL
7079 mono_return_double8 (double8 s8, int addend) {
7081 fprintf(stderr, "mono_return_double8 s8.f1: got %f but expected %d\n", s8.f1, 1);
7084 fprintf(stderr, "mono_return_double8 s8.f2: got %f but expected %d\n", s8.f2, 2);
7087 fprintf(stderr, "mono_return_double8 s8.f3: got %f but expected %d\n", s8.f3, 3);
7090 fprintf(stderr, "mono_return_double8 s8.f4: got %f but expected %d\n", s8.f4, 4);
7093 fprintf(stderr, "mono_return_double8 s8.f5: got %f but expected %d\n", s8.f5, 5);
7096 fprintf(stderr, "mono_return_double8 s8.f6: got %f but expected %d\n", s8.f6, 6);
7099 fprintf(stderr, "mono_return_double8 s8.f7: got %f but expected %d\n", s8.f7, 7);
7102 fprintf(stderr, "mono_return_double8 s8.f8: got %f but expected %d\n", s8.f8, 8);
7104 s8.f1+=addend; s8.f2+=addend; s8.f3+=addend; s8.f4+=addend; s8.f5+=addend; s8.f6+=addend; s8.f7+=addend; s8.f8+=addend;
7109 double f1,f2,f3,f4,f5,f6,f7,f8,f9;
7112 LIBTEST_API double9 STDCALL
7113 mono_return_double9 (double9 s9, int addend) {
7115 fprintf(stderr, "mono_return_double9 s9.f1: got %f but expected %d\n", s9.f1, 1);
7118 fprintf(stderr, "mono_return_double9 s9.f2: got %f but expected %d\n", s9.f2, 2);
7121 fprintf(stderr, "mono_return_double9 s9.f3: got %f but expected %d\n", s9.f3, 3);
7124 fprintf(stderr, "mono_return_double9 s9.f4: got %f but expected %d\n", s9.f4, 4);
7127 fprintf(stderr, "mono_return_double9 s9.f5: got %f but expected %d\n", s9.f5, 5);
7130 fprintf(stderr, "mono_return_double9 s9.f6: got %f but expected %d\n", s9.f6, 6);
7133 fprintf(stderr, "mono_return_double9 s9.f7: got %f but expected %d\n", s9.f7, 7);
7136 fprintf(stderr, "mono_return_double9 s9.f8: got %f but expected %d\n", s9.f8, 8);
7139 fprintf(stderr, "mono_return_double9 s9.f9: got %f but expected %d\n", s9.f9, 9);
7141 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;
7154 LIBTEST_API double2_nested STDCALL
7155 mono_return_double2_nested (double2_nested sn2, int addend) {
7156 if (sn2.nested1.f1 != 1) {
7157 fprintf(stderr, "mono_return_double2_nested sn2.nested1.f1: got %f but expected %d\n", sn2.nested1.f1, 1);
7159 if (sn2.nested2.f2 != 2) {
7160 fprintf(stderr, "mono_return_double2_nested sn2.nested2.f2: got %f but expected %d\n", sn2.nested2.f2, 2);
7162 sn2.nested1.f1+=addend; sn2.nested2.f2+=addend;
7172 LIBTEST_API double_array4 STDCALL
7173 mono_return_double_array4 (double_array4 sa4, int addend) {
7174 if (sa4.f1[0] != 1) {
7175 fprintf(stderr, "mono_return_double_array4 sa4.f1[0]: got %f but expected %d\n", sa4.f1[0], 1);
7177 if (sa4.f1[1] != 2) {
7178 fprintf(stderr, "mono_return_double_array4 sa4.f1[1]: got %f but expected %d\n", sa4.f1[1], 2);
7180 if (sa4.f1[2] != 3) {
7181 fprintf(stderr, "mono_return_double_array4 sa4.f1[2]: got %f but expected %d\n", sa4.f1[2], 3);
7183 if (sa4.f1[3] != 4) {
7184 fprintf(stderr, "mono_return_double_array4 sa4.f1[3]: got %f but expected %d\n", sa4.f1[3], 4);
7186 sa4.f1[0]+=addend; sa4.f1[1]+=addend; sa4.f1[2]+=addend; sa4.f1[3]+=addend;