19 #define STDCALL __stdcall
25 #pragma GCC diagnostic ignored "-Wmissing-prototypes"
29 extern __declspec(dllimport
) void __stdcall
CoTaskMemFree(void *ptr
);
32 typedef int (STDCALL
*SimpleDelegate
) (int a
);
34 #if defined(WIN32) && defined (_MSC_VER)
35 #define LIBTEST_API __declspec(dllexport)
36 #elif defined(__GNUC__)
37 #define LIBTEST_API __attribute__ ((visibility ("default")))
42 static void marshal_free (void *ptr
)
51 static void* marshal_alloc (gsize size
)
54 return CoTaskMemAlloc (size
);
56 return g_malloc (size
);
60 static void* marshal_alloc0 (gsize size
)
63 void* ptr
= CoTaskMemAlloc (size
);
67 return g_malloc0 (size
);
71 static char* marshal_strdup (const char *str
)
81 buf
= (char *) CoTaskMemAlloc (len
+ 1);
82 return strcpy (buf
, str
);
84 return g_strdup (str
);
88 static gunichar2
* marshal_bstr_alloc(const gchar
* str
)
91 gunichar2
* ret
= NULL
;
92 gunichar2
* temp
= NULL
;
93 temp
= g_utf8_to_utf16 (str
, -1, NULL
, NULL
, NULL
);
94 ret
= SysAllocString (temp
);
99 int slen
= strlen (str
);
101 /* allocate len + 1 utf16 characters plus 4 byte integer for length*/
102 ret
= (gchar
*)g_malloc ((slen
+ 1) * sizeof(gunichar2
) + sizeof(guint32
));
105 temp
= g_utf8_to_utf16 (str
, -1, NULL
, NULL
, NULL
);
106 memcpy (ret
+ sizeof(guint32
), temp
, slen
* sizeof(gunichar2
));
107 * ((guint32
*) ret
) = slen
* sizeof(gunichar2
);
108 ret
[4 + slen
* sizeof(gunichar2
)] = 0;
109 ret
[5 + slen
* sizeof(gunichar2
)] = 0;
111 return (gunichar2
*)(ret
+ 4);
115 #define marshal_new0(type,size) ((type *) marshal_alloc0 (sizeof (type)* (size)))
117 LIBTEST_API
int STDCALL
118 mono_cominterop_is_supported (void)
120 #if defined(TARGET_X86) || defined(TARGET_AMD64)
126 LIBTEST_API
unsigned short* STDCALL
127 test_lpwstr_marshal (unsigned short* chars
, long length
)
132 res
= (unsigned short *)marshal_alloc (2 * (length
+ 1));
134 // printf("test_lpwstr_marshal()\n");
136 while ( i
< length
) {
137 // printf("X|%u|\n", chars[i]);
148 LIBTEST_API
void STDCALL
149 test_lpwstr_marshal_out (unsigned short** chars
)
152 const char abc
[] = "ABC";
153 glong len
= strlen(abc
);
155 *chars
= (unsigned short *)marshal_alloc (2 * (len
+ 1));
158 (*chars
) [i
] = abc
[i
];
171 LIBTEST_API
int STDCALL
172 mono_union_test_1 (union_test_1_type u1
) {
173 // printf ("Got values %d %d %d\n", u1.b, u1.a, u1.c);
174 return u1
.a
+ u1
.b
+ u1
.c
;
177 LIBTEST_API
int STDCALL
178 mono_return_int (int a
) {
179 // printf ("Got value %d\n", a);
183 LIBTEST_API
float STDCALL
184 mono_test_marshal_pass_return_float (float f
) {
193 LIBTEST_API
int STDCALL
194 mono_return_int_ss (struct ss a
) {
195 // printf ("Got value %d\n", a.i);
199 LIBTEST_API
struct ss STDCALL
200 mono_return_ss (struct ss a
) {
201 // printf ("Got value %d\n", a.i);
211 LIBTEST_API
struct sc1 STDCALL
212 mono_return_sc1 (struct sc1 a
) {
213 // printf ("Got value %d\n", a.c[0]);
224 LIBTEST_API
struct sc3 STDCALL
225 mono_return_sc3 (struct sc3 a
) {
226 // printf ("Got values %d %d %d\n", a.c[0], a.c[1], a.c[2]);
238 LIBTEST_API
struct sc5 STDCALL
239 mono_return_sc5 (struct sc5 a
) {
240 // printf ("Got values %d %d %d %d %d\n", a.c[0], a.c[1], a.c[2], a.c[3], a.c[4]);
255 LIBTEST_API
int STDCALL
256 mono_return_int_su (union su a
) {
257 // printf ("Got value %d\n", a.i1);
272 LIBTEST_API
struct NestedFloat STDCALL
273 mono_return_nested_float (void)
275 struct NestedFloat f
;
283 LIBTEST_API
int STDCALL
284 mono_test_many_int_arguments (int a
, int b
, int c
, int d
, int e
,
285 int f
, int g
, int h
, int i
, int j
);
286 LIBTEST_API
short STDCALL
287 mono_test_many_short_arguments (short a
, short b
, short c
, short d
, short e
,
288 short f
, short g
, short h
, short i
, short j
);
289 LIBTEST_API
char STDCALL
290 mono_test_many_char_arguments (char a
, char b
, char c
, char d
, char e
,
291 char f
, char g
, char h
, char i
, char j
);
293 LIBTEST_API
int STDCALL
294 mono_test_many_int_arguments (int a
, int b
, int c
, int d
, int e
, int f
, int g
, int h
, int i
, int j
)
296 return a
+ b
+ c
+ d
+ e
+ f
+ g
+ h
+ i
+ j
;
299 LIBTEST_API
short STDCALL
300 mono_test_many_short_arguments (short a
, short b
, short c
, short d
, short e
, short f
, short g
, short h
, short i
, short j
)
302 return a
+ b
+ c
+ d
+ e
+ f
+ g
+ h
+ i
+ j
;
305 LIBTEST_API
char STDCALL
306 mono_test_many_byte_arguments (char a
, char b
, char c
, char d
, char e
, char f
, char g
, char h
, char i
, char j
)
308 return a
+ b
+ c
+ d
+ e
+ f
+ g
+ h
+ i
+ j
;
311 LIBTEST_API
float STDCALL
312 mono_test_many_float_arguments (float a
, float b
, float c
, float d
, float e
, float f
, float g
, float h
, float i
, float j
)
314 return a
+ b
+ c
+ d
+ e
+ f
+ g
+ h
+ i
+ j
;
317 LIBTEST_API
double STDCALL
318 mono_test_many_double_arguments (double a
, double b
, double c
, double d
, double e
, double f
, double g
, double h
, double i
, double j
)
320 return a
+ b
+ c
+ d
+ e
+ f
+ g
+ h
+ i
+ j
;
323 LIBTEST_API
double STDCALL
324 mono_test_split_double_arguments (double a
, double b
, float c
, double d
, double e
)
326 return a
+ b
+ c
+ d
+ e
;
329 LIBTEST_API
int STDCALL
330 mono_test_puts_static (char *s
)
332 // printf ("TEST %s\n", s);
336 typedef int (STDCALL
*SimpleDelegate3
) (int a
, int b
);
338 LIBTEST_API
int STDCALL
339 mono_invoke_delegate (SimpleDelegate3 delegate
)
343 // printf ("start invoke %p\n", delegate);
345 res
= delegate (2, 3);
347 // printf ("end invoke\n");
352 LIBTEST_API
int STDCALL
353 mono_invoke_simple_delegate (SimpleDelegate d
)
358 LIBTEST_API
int STDCALL
359 mono_test_marshal_char (short a1
)
367 LIBTEST_API
void STDCALL
368 mono_test_marshal_char_array (gunichar2
*s
)
370 const char m
[] = "abcdef";
374 s2
= g_utf8_to_utf16 (m
, -1, NULL
, &len
, NULL
);
382 LIBTEST_API
int STDCALL
383 mono_test_marshal_ansi_char_array (char *s
)
385 const char m
[] = "abcdef";
387 if (strncmp ("qwer", s
, 4))
390 memcpy (s
, m
, sizeof (m
));
394 LIBTEST_API
int STDCALL
395 mono_test_marshal_unicode_char_array (gunichar2
*s
)
397 const char m
[] = "abcdef";
398 const char expected
[] = "qwer";
402 s1
= g_utf8_to_utf16 (m
, -1, NULL
, &len1
, NULL
);
403 s2
= g_utf8_to_utf16 (expected
, -1, NULL
, &len2
, NULL
);
407 if (memcmp (s
, s2
, len2
))
410 memcpy (s
, s1
, len1
);
414 LIBTEST_API
int STDCALL
415 mono_test_empty_pinvoke (int i
)
420 LIBTEST_API
int STDCALL
421 mono_test_marshal_bool_byref (int a
, int *b
, int c
)
430 LIBTEST_API
int STDCALL
431 mono_test_marshal_bool_in_as_I1_U1 (char bTrue
, char bFalse
)
440 LIBTEST_API
int STDCALL
441 mono_test_marshal_bool_out_as_I1_U1 (char* bTrue
, char* bFalse
)
443 if (!bTrue
|| !bFalse
)
452 LIBTEST_API
int STDCALL
453 mono_test_marshal_bool_ref_as_I1_U1 (char* bTrue
, char* bFalse
)
455 if (!bTrue
|| !bFalse
)
469 LIBTEST_API
int STDCALL
470 mono_test_marshal_array (int *a1
)
474 for (i
= 0; i
< 50; i
++)
480 LIBTEST_API
int STDCALL
481 mono_test_marshal_inout_array (int *a1
)
485 for (i
= 0; i
< 50; i
++) {
487 a1
[i
] = 50 - a1
[i
];
493 LIBTEST_API
int /* cdecl */
494 mono_test_marshal_inout_array_cdecl (int *a1
)
496 return mono_test_marshal_inout_array (a1
);
499 LIBTEST_API
int STDCALL
500 mono_test_marshal_out_array (int *a1
)
504 for (i
= 0; i
< 50; i
++) {
511 LIBTEST_API
int STDCALL
512 mono_test_marshal_out_byref_array_out_size_param (int **out_arr
, int *out_len
)
518 arr
= (gint32
*)marshal_alloc (sizeof (gint32
) * len
);
519 for (i
= 0; i
< len
; ++i
)
527 LIBTEST_API
int STDCALL
528 mono_test_marshal_out_lparray_out_size_param (int *arr
, int *out_len
)
533 for (i
= 0; i
< len
; ++i
)
540 LIBTEST_API
int STDCALL
541 mono_test_marshal_inout_nonblittable_array (gunichar2
*a1
)
545 for (i
= 0; i
< 10; i
++) {
565 LIBTEST_API simplestruct STDCALL
566 mono_test_return_vtype (int i
)
569 static gunichar2 test2
[] = { 'T', 'E', 'S', 'T', '2', 0 };
580 LIBTEST_API
void STDCALL
581 mono_test_delegate_struct (void)
583 // printf ("TEST\n");
586 typedef char* (STDCALL
*ReturnStringDelegate
) (const char *s
);
588 LIBTEST_API
char * STDCALL
589 mono_test_return_string (ReturnStringDelegate func
)
593 // printf ("mono_test_return_string\n");
598 // printf ("got string: %s\n", res);
599 return marshal_strdup ("12345");
602 typedef int (STDCALL
*RefVTypeDelegate
) (int a
, simplestruct
*ss
, int b
);
604 LIBTEST_API
int STDCALL
605 mono_test_ref_vtype (int a
, simplestruct
*ss
, int b
, RefVTypeDelegate func
)
607 if (a
== 1 && b
== 2 && ss
->a
== 0 && ss
->b
== 1 && ss
->c
== 0 &&
608 !strcmp (ss
->d
, "TEST1")) {
614 return func (a
, ss
, b
);
620 typedef int (STDCALL
*OutVTypeDelegate
) (int a
, simplestruct
*ss
, int b
);
622 LIBTEST_API
int STDCALL
623 mono_test_marshal_out_struct (int a
, simplestruct
*ss
, int b
, OutVTypeDelegate func
)
625 /* Check that the input pointer is ignored */
626 ss
->d
= (const char *)0x12345678;
630 if (ss
->a
&& ss
->b
&& ss
->c
&& !strcmp (ss
->d
, "TEST3"))
636 typedef int (STDCALL
*InVTypeDelegate
) (int a
, simplestruct
*ss
, int b
);
638 LIBTEST_API
int STDCALL
639 mono_test_marshal_in_struct (int a
, simplestruct
*ss
, int b
, InVTypeDelegate func
)
644 memcpy (&ss2
, ss
, sizeof (simplestruct
));
646 res
= func (a
, ss
, b
);
648 printf ("mono_test_marshal_in_struct () failed: %d\n", res
);
652 /* Check that no modifications is made to the struct */
653 if (ss2
.a
== ss
->a
&& ss2
.b
== ss
->b
&& ss2
.c
== ss
->c
&& ss2
.d
== ss
->d
)
661 SimpleDelegate func
, func2
, func3
;
664 LIBTEST_API DelegateStruct STDCALL
665 mono_test_marshal_delegate_struct (DelegateStruct ds
)
669 res
.a
= ds
.func (ds
.a
) + ds
.func2 (ds
.a
) + (ds
.func3
== NULL
? 0 : 1);
671 res
.func2
= ds
.func2
;
677 LIBTEST_API
int STDCALL
678 mono_test_marshal_struct (simplestruct ss
)
680 if (ss
.a
== 0 && ss
.b
== 1 && ss
.c
== 0 &&
681 !strcmp (ss
.d
, "TEST"))
687 LIBTEST_API
int STDCALL
688 mono_test_marshal_byref_struct (simplestruct
*ss
, int a
, int b
, int c
, char *d
)
690 gboolean res
= (ss
->a
== a
&& ss
->b
== b
&& ss
->c
== c
&& strcmp (ss
->d
, d
) == 0);
692 marshal_free ((char*)ss
->d
);
697 ss
->d
= marshal_strdup ("DEF");
713 LIBTEST_API
int STDCALL
714 mono_test_marshal_struct2 (simplestruct2 ss
)
716 if (ss
.a
== 0 && ss
.b
== 1 && ss
.c
== 0 &&
717 !strcmp (ss
.d
, "TEST") &&
718 ss
.e
== 99 && ss
.f
== 1.5 && ss
.g
== 42 && ss
.h
== (guint64
)123)
724 /* on HP some of the struct should be on the stack and not in registers */
725 LIBTEST_API
int STDCALL
726 mono_test_marshal_struct2_2 (int i
, int j
, int k
, simplestruct2 ss
)
728 if (i
!= 10 || j
!= 11 || k
!= 12)
730 if (ss
.a
== 0 && ss
.b
== 1 && ss
.c
== 0 &&
731 !strcmp (ss
.d
, "TEST") &&
732 ss
.e
== 99 && ss
.f
== 1.5 && ss
.g
== 42 && ss
.h
== (guint64
)123)
738 LIBTEST_API
int STDCALL
739 mono_test_marshal_lpstruct (simplestruct
*ss
)
741 if (ss
->a
== 0 && ss
->b
== 1 && ss
->c
== 0 &&
742 !strcmp (ss
->d
, "TEST"))
748 LIBTEST_API
int STDCALL
749 mono_test_marshal_lpstruct_blittable (point
*p
)
751 if (p
->x
== 1.0 && p
->y
== 2.0)
757 LIBTEST_API
int STDCALL
758 mono_test_marshal_struct_array (simplestruct2
*ss
)
760 if (! (ss
[0].a
== 0 && ss
[0].b
== 1 && ss
[0].c
== 0 &&
761 !strcmp (ss
[0].d
, "TEST") &&
762 ss
[0].e
== 99 && ss
[0].f
== 1.5 && ss
[0].g
== 42 && ss
[0].h
== (guint64
)123))
765 if (! (ss
[1].a
== 0 && ss
[1].b
== 0 && ss
[1].c
== 0 &&
766 !strcmp (ss
[1].d
, "TEST2") &&
767 ss
[1].e
== 100 && ss
[1].f
== 2.5 && ss
[1].g
== 43 && ss
[1].h
== (guint64
)124))
773 typedef struct long_align_struct
{
779 LIBTEST_API
int STDCALL
780 mono_test_marshal_long_align_struct_array (long_align_struct
*ss
)
782 return ss
[0].a
+ ss
[0].b
+ ss
[0].c
+ ss
[1].a
+ ss
[1].b
+ ss
[1].c
;
785 LIBTEST_API simplestruct2
* STDCALL
786 mono_test_marshal_class (int i
, int j
, int k
, simplestruct2
*ss
, int l
)
793 if (i
!= 10 || j
!= 11 || k
!= 12 || l
!= 14)
795 if (! (ss
->a
== 0 && ss
->b
== 1 && ss
->c
== 0 &&
796 !strcmp (ss
->d
, "TEST") &&
797 ss
->e
== 99 && ss
->f
== 1.5 && ss
->g
== 42 && ss
->h
== (guint64
)123))
800 res
= marshal_new0 (simplestruct2
, 1);
801 memcpy (res
, ss
, sizeof (simplestruct2
));
802 res
->d
= marshal_strdup ("TEST");
806 LIBTEST_API
int STDCALL
807 mono_test_marshal_byref_class (simplestruct2
**ssp
)
809 simplestruct2
*ss
= *ssp
;
812 if (! (ss
->a
== 0 && ss
->b
== 1 && ss
->c
== 0 &&
813 !strcmp (ss
->d
, "TEST") &&
814 ss
->e
== 99 && ss
->f
== 1.5 && ss
->g
== 42 && ss
->h
== (guint64
)123))
817 res
= marshal_new0 (simplestruct2
, 1);
818 memcpy (res
, ss
, sizeof (simplestruct2
));
819 res
->d
= marshal_strdup ("TEST-RES");
831 /* Yes, this is correct, we are only trying to determine the value of the stack here */
836 LIBTEST_API
int STDCALL
837 reliable_delegate (int a
)
843 * Checks whether get_sp() works as expected. It doesn't work with gcc-2.95.3 on linux.
846 is_get_sp_reliable (void)
850 reliable_delegate(1);
852 reliable_delegate(1);
857 LIBTEST_API
int STDCALL
858 mono_test_marshal_delegate (SimpleDelegate delegate
)
862 /* Check that the delegate wrapper is stdcall */
867 if (is_get_sp_reliable())
868 g_assert (sp1
== sp2
);
873 static int STDCALL
inc_cb (int i
)
878 LIBTEST_API
int STDCALL
879 mono_test_marshal_out_delegate (SimpleDelegate
*delegate
)
886 LIBTEST_API SimpleDelegate STDCALL
887 mono_test_marshal_return_delegate (SimpleDelegate delegate
)
892 typedef int DelegateByrefDelegate (void *);
894 LIBTEST_API
int STDCALL
895 mono_test_marshal_delegate_ref_delegate (DelegateByrefDelegate del
)
905 return_plus_one (int i
)
910 LIBTEST_API SimpleDelegate STDCALL
911 mono_test_marshal_return_delegate_2 (void)
913 return return_plus_one
;
916 typedef simplestruct (STDCALL
*SimpleDelegate2
) (simplestruct ss
);
919 is_utf16_equals (gunichar2
*s1
, const char *s2
)
924 s
= g_utf16_to_utf8 (s1
, -1, NULL
, NULL
, NULL
);
925 res
= strcmp (s
, s2
);
931 LIBTEST_API
int STDCALL
932 mono_test_marshal_delegate2 (SimpleDelegate2 delegate
)
934 simplestruct ss
, res
;
940 ss
.d2
= g_utf8_to_utf16 ("TEST2", -1, NULL
, NULL
, NULL
);
943 if (! (res
.a
&& !res
.b
&& res
.c
&& !strcmp (res
.d
, "TEST-RES") && is_utf16_equals (res
.d2
, "TEST2-RES")))
949 typedef simplestruct
* (STDCALL
*SimpleDelegate4
) (simplestruct
*ss
);
951 LIBTEST_API
int STDCALL
952 mono_test_marshal_delegate4 (SimpleDelegate4 delegate
)
963 res
= delegate (&ss
);
967 /* Check return value */
968 if (! (!res
->a
&& res
->b
&& !res
->c
&& !strcmp (res
->d
, "TEST")))
971 /* Check NULL argument and NULL result */
972 res
= delegate (NULL
);
979 typedef int (STDCALL
*SimpleDelegate5
) (simplestruct
**ss
);
981 LIBTEST_API
int STDCALL
982 mono_test_marshal_delegate5 (SimpleDelegate5 delegate
)
995 res
= delegate (&ptr
);
999 if (!(ptr
->a
&& !ptr
->b
&& ptr
->c
&& !strcmp (ptr
->d
, "RES")))
1005 LIBTEST_API
int STDCALL
1006 mono_test_marshal_delegate6 (SimpleDelegate5 delegate
)
1012 typedef int (STDCALL
*SimpleDelegate7
) (simplestruct
**ss
);
1014 LIBTEST_API
int STDCALL
1015 mono_test_marshal_delegate7 (SimpleDelegate7 delegate
)
1020 /* Check that the input pointer is ignored */
1021 ptr
= (simplestruct
*)0x12345678;
1023 res
= delegate (&ptr
);
1027 if (!(ptr
->a
&& !ptr
->b
&& ptr
->c
&& !strcmp (ptr
->d
, "RES")))
1033 typedef int (STDCALL
*InOutByvalClassDelegate
) (simplestruct
*ss
);
1035 LIBTEST_API
int STDCALL
1036 mono_test_marshal_inout_byval_class_delegate (InOutByvalClassDelegate delegate
)
1044 ss
.d
= g_strdup_printf ("%s", "FOO");
1046 res
= delegate (&ss
);
1050 if (!(ss
.a
&& !ss
.b
&& ss
.c
&& !strcmp (ss
.d
, "RES")))
1056 typedef int (STDCALL
*SimpleDelegate8
) (gunichar2
*s
);
1058 LIBTEST_API
int STDCALL
1059 mono_test_marshal_delegate8 (SimpleDelegate8 delegate
, gunichar2
*s
)
1061 return delegate (s
);
1064 typedef int (STDCALL
*return_int_fnt
) (int i
);
1065 typedef int (STDCALL
*SimpleDelegate9
) (return_int_fnt d
);
1067 LIBTEST_API
int STDCALL
1068 mono_test_marshal_delegate9 (SimpleDelegate9 delegate
, gpointer ftn
)
1070 return delegate ((return_int_fnt
)ftn
);
1079 LIBTEST_API
int STDCALL
1080 mono_test_marshal_delegate10 (SimpleDelegate9 delegate
)
1082 return delegate (return_self
);
1085 typedef int (STDCALL
*PrimitiveByrefDelegate
) (int *i
);
1087 LIBTEST_API
int STDCALL
1088 mono_test_marshal_primitive_byref_delegate (PrimitiveByrefDelegate delegate
)
1092 int res
= delegate (&i
);
1102 typedef int (STDCALL
*return_int_delegate
) (int i
);
1104 typedef return_int_delegate (STDCALL
*ReturnDelegateDelegate
) (void);
1106 LIBTEST_API
int STDCALL
1107 mono_test_marshal_return_delegate_delegate (ReturnDelegateDelegate d
)
1112 typedef int (STDCALL
*VirtualDelegate
) (int);
1114 LIBTEST_API
int STDCALL
1115 mono_test_marshal_virtual_delegate (VirtualDelegate del
)
1120 typedef char* (STDCALL
*IcallDelegate
) (const char *);
1121 LIBTEST_API
int STDCALL
1122 mono_test_marshal_icall_delegate (IcallDelegate del
)
1124 char *res
= del ("ABC");
1125 return strcmp (res
, "ABC") == 0 ? 0 : 1;
1128 LIBTEST_API
int STDCALL
1129 mono_test_marshal_stringbuilder (char *s
, int n
)
1131 const char m
[] = "This is my message. Isn't it nice?";
1133 if (strcmp (s
, "ABCD") != 0)
1140 LIBTEST_API
int STDCALL
1141 mono_test_marshal_stringbuilder_append (char *s
, int length
)
1143 const char out_sentinel
[] = "CSHARP_";
1144 const char out_len
= strlen (out_sentinel
);
1146 for (int i
=0; i
< length
; i
++) {
1147 s
[i
] = out_sentinel
[i
% out_len
];
1156 LIBTEST_API
int STDCALL
1157 mono_test_marshal_stringbuilder_default (char *s
, int n
)
1159 const char m
[] = "This is my message. Isn't it nice?";
1166 LIBTEST_API
int STDCALL
1167 mono_test_marshal_stringbuilder_unicode (gunichar2
*s
, int n
)
1169 const char m
[] = "This is my message. Isn't it nice?";
1173 s2
= g_utf8_to_utf16 (m
, -1, NULL
, &len
, NULL
);
1175 len
= (len
* 2) + 2;
1178 memcpy (s
, s2
, len
);
1185 LIBTEST_API
void STDCALL
1186 mono_test_marshal_stringbuilder_out (char **s
)
1188 const char m
[] = "This is my message. Isn't it nice?";
1191 str
= (char *)marshal_alloc (strlen (m
) + 1);
1192 memcpy (str
, m
, strlen (m
) + 1);
1197 LIBTEST_API
int STDCALL
1198 mono_test_marshal_stringbuilder_out_unicode (gunichar2
**s
)
1200 const char m
[] = "This is my message. Isn't it nice?";
1204 s2
= g_utf8_to_utf16 (m
, -1, NULL
, &len
, NULL
);
1206 len
= (len
* 2) + 2;
1207 *s
= (gunichar2
*)marshal_alloc (len
);
1208 memcpy (*s
, s2
, len
);
1215 LIBTEST_API
int STDCALL
1216 mono_test_marshal_stringbuilder_ref (char **s
)
1218 const char m
[] = "This is my message. Isn't it nice?";
1221 if (strcmp (*s
, "ABC"))
1224 str
= (char *)marshal_alloc (strlen (m
) + 1);
1225 memcpy (str
, m
, strlen (m
) + 1);
1231 #pragma GCC diagnostic push
1232 #pragma GCC diagnostic ignored "-Wc++-compat"
1238 #pragma GCC diagnostic pop
1240 LIBTEST_API
int STDCALL
1241 mono_test_marshal_empty_string_array (char **array
)
1243 return (array
== NULL
) ? 0 : 1;
1246 LIBTEST_API
int STDCALL
1247 mono_test_marshal_string_array (char **array
)
1249 if (strcmp (array
[0], "ABC"))
1251 if (strcmp (array
[1], "DEF"))
1254 if (array
[2] != NULL
)
1260 LIBTEST_API
int STDCALL
1261 mono_test_marshal_byref_string_array (char ***array
)
1266 if (strcmp ((*array
) [0], "Alpha"))
1268 if (strcmp ((*array
) [1], "Beta"))
1270 if (strcmp ((*array
) [2], "Gamma"))
1276 LIBTEST_API
int STDCALL
1277 mono_test_marshal_stringbuilder_array (char **array
)
1279 if (strcmp (array
[0], "ABC"))
1281 if (strcmp (array
[1], "DEF"))
1284 strcpy (array
[0], "DEF");
1285 strcpy (array
[1], "ABC");
1290 LIBTEST_API
int STDCALL
1291 mono_test_marshal_unicode_string_array (gunichar2
**array
, char **array2
)
1293 GError
*error
= NULL
;
1296 s
= g_utf16_to_utf8 (array
[0], -1, NULL
, NULL
, &error
);
1297 if (strcmp (s
, "ABC")) {
1304 s
= g_utf16_to_utf8 (array
[1], -1, NULL
, NULL
, &error
);
1305 if (strcmp (s
, "DEF")) {
1312 if (strcmp (array2
[0], "ABC"))
1315 if (strcmp (array2
[1], "DEF"))
1321 /* this does not work on Redhat gcc 2.96 */
1322 LIBTEST_API
int STDCALL
1323 mono_test_empty_struct (int a
, EmptyStruct es
, int b
)
1325 // printf ("mono_test_empty_struct %d %d\n", a, b);
1327 // Intel icc on ia64 passes 'es' in 2 registers
1328 #if defined(__ia64) && defined(__INTEL_COMPILER)
1331 if (a
== 1 && b
== 2)
1337 LIBTEST_API EmptyStruct STDCALL
1338 mono_test_return_empty_struct (int a
)
1351 LIBTEST_API ByValStrStruct
* STDCALL
1352 mono_test_byvalstr_gen (void)
1354 ByValStrStruct
*ret
;
1356 ret
= (ByValStrStruct
*)malloc (sizeof (ByValStrStruct
));
1357 memset(ret
, 'a', sizeof(ByValStrStruct
)-1);
1358 ret
->a
[sizeof(ByValStrStruct
)-1] = 0;
1363 LIBTEST_API
int STDCALL
1364 mono_test_byvalstr_check (ByValStrStruct
* data
, char* correctString
)
1368 ret
= strcmp(data
->a
, correctString
);
1369 // printf ("T1: %s\n", data->a);
1370 // printf ("T2: %s\n", correctString);
1372 /* we need g_free because the allocation was performed by mono_test_byvalstr_gen */
1380 } ByValStrStruct_Unicode
;
1382 LIBTEST_API
int STDCALL
1383 mono_test_byvalstr_check_unicode (ByValStrStruct_Unicode
*ref
, int test
)
1385 if (ref
->flag
!= 0x1234abcd){
1386 printf ("overwritten data");
1390 if (test
== 1 || test
== 3){
1391 if (ref
->a
[0] != '1' ||
1392 ref
->a
[1] != '2' ||
1398 if (ref
->a
[0] != '1' ||
1406 LIBTEST_API
int STDCALL
1407 NameManglingAnsi (char *data
)
1409 return data
[0] + data
[1] + data
[2];
1412 LIBTEST_API
int STDCALL
1413 NameManglingAnsiA (char *data
)
1415 g_assert_not_reached ();
1418 LIBTEST_API
int STDCALL
1419 NameManglingAnsiW (char *data
)
1421 g_assert_not_reached ();
1424 LIBTEST_API
int STDCALL
1425 NameManglingAnsi2A (char *data
)
1427 return data
[0] + data
[1] + data
[2];
1430 LIBTEST_API
int STDCALL
1431 NameManglingAnsi2W (char *data
)
1433 g_assert_not_reached ();
1436 LIBTEST_API
int STDCALL
1437 NameManglingUnicode (char *data
)
1439 g_assert_not_reached ();
1442 LIBTEST_API
int STDCALL
1443 NameManglingUnicodeW (gunichar2
*data
)
1445 return data
[0] + data
[1] + data
[2];
1448 LIBTEST_API
int STDCALL
1449 NameManglingUnicode2 (gunichar2
*data
)
1451 return data
[0] + data
[1] + data
[2];
1454 LIBTEST_API
int STDCALL
1455 NameManglingAutoW (char *data
)
1458 return (data
[0] + data
[1] + data
[2]) == 131 ? 0 : 1;
1460 g_assert_not_reached ();
1464 LIBTEST_API
int STDCALL
1465 NameManglingAuto (char *data
)
1468 return (data
[0] + data
[1] + data
[2]) == 198 ? 0 : 1;
1470 g_assert_not_reached ();
1474 typedef int (STDCALL
*intcharFunc
)(const char*);
1476 LIBTEST_API
void STDCALL
1477 callFunction (intcharFunc f
)
1487 LIBTEST_API
int STDCALL
1488 class_marshal_test0 (SimpleObj
*obj1
)
1490 // printf ("class_marshal_test0 %s %d\n", obj1->str, obj1->i);
1492 if (strcmp(obj1
->str
, "T1"))
1500 LIBTEST_API
int STDCALL
1501 class_marshal_test4 (SimpleObj
*obj1
)
1509 LIBTEST_API
void STDCALL
1510 class_marshal_test1 (SimpleObj
**obj1
)
1512 SimpleObj
*res
= (SimpleObj
*)malloc (sizeof (SimpleObj
));
1514 res
->str
= marshal_strdup ("ABC");
1520 LIBTEST_API
int STDCALL
1521 class_marshal_test2 (SimpleObj
**obj1
)
1523 // printf ("class_marshal_test2 %s %d\n", (*obj1)->str, (*obj1)->i);
1525 if (strcmp((*obj1
)->str
, "ABC"))
1527 if ((*obj1
)->i
!= 5)
1533 LIBTEST_API
int STDCALL
1534 string_marshal_test0 (char *str
)
1536 if (strcmp (str
, "TEST0"))
1542 LIBTEST_API
void STDCALL
1543 string_marshal_test1 (const char **str
)
1545 *str
= marshal_strdup ("TEST1");
1548 LIBTEST_API
int STDCALL
1549 string_marshal_test2 (char **str
)
1551 // printf ("string_marshal_test2 %s\n", *str);
1553 if (strcmp (*str
, "TEST1"))
1556 *str
= marshal_strdup ("TEST2");
1561 LIBTEST_API
int STDCALL
1562 string_marshal_test3 (char *str
)
1575 LIBTEST_API BlittableClass
* STDCALL
1576 TestBlittableClass (BlittableClass
*vl
)
1578 BlittableClass
*res
;
1580 // printf ("TestBlittableClass %d %d\n", vl->a, vl->b);
1586 res
= marshal_new0 (BlittableClass
, 1);
1587 memcpy (res
, vl
, sizeof (BlittableClass
));
1589 res
= marshal_new0 (BlittableClass
, 1);
1597 typedef struct OSVERSIONINFO_STRUCT
1601 } OSVERSIONINFO_STRUCT
;
1603 LIBTEST_API
int STDCALL
1604 MyGetVersionEx (OSVERSIONINFO_STRUCT
*osvi
)
1607 // printf ("GOT %d %d\n", osvi->a, osvi->b);
1612 return osvi
->a
+ osvi
->b
;
1615 LIBTEST_API
int STDCALL
1616 BugGetVersionEx (int a
, int b
, int c
, int d
, int e
, int f
, int g
, int h
, OSVERSIONINFO_STRUCT
*osvi
)
1619 // printf ("GOT %d %d\n", osvi->a, osvi->b);
1624 return osvi
->a
+ osvi
->b
;
1627 LIBTEST_API
int STDCALL
1628 mono_test_marshal_point (point pt
)
1630 // printf("point %g %g\n", pt.x, pt.y);
1631 if (pt
.x
== 1.25 && pt
.y
== 3.5)
1642 LIBTEST_API
int STDCALL
1643 mono_test_marshal_mixed_point (mixed_point pt
)
1645 // printf("mixed point %d %g\n", pt.x, pt.y);
1646 if (pt
.x
== 5 && pt
.y
== 6.75)
1652 LIBTEST_API
int STDCALL
1653 mono_test_marshal_mixed_point_2 (mixed_point
*pt
)
1655 if (pt
->x
!= 5 || pt
->y
!= 6.75)
1664 LIBTEST_API
int STDCALL
1665 marshal_test_ref_bool(int i
, char *b1
, short *b2
, int *b3
)
1668 if (*b1
!= 0 && *b1
!= 1)
1670 if (*b2
!= 0 && *b2
!= -1) /* variant_bool */
1672 if (*b3
!= 0 && *b3
!= 1)
1674 if (i
== ((*b1
<< 2) | (-*b2
<< 1) | *b3
))
1686 short b2
; /* variant_bool */
1690 LIBTEST_API
int STDCALL
1691 marshal_test_bool_struct(struct BoolStruct
*s
)
1694 if (s
->b1
!= 0 && s
->b1
!= 1)
1696 if (s
->b2
!= 0 && s
->b2
!= -1)
1698 if (s
->b3
!= 0 && s
->b3
!= 1)
1700 if (s
->i
== ((s
->b1
<< 2) | (-s
->b2
<< 1) | s
->b3
))
1717 LIBTEST_API
int STDCALL
1718 mono_test_marshal_long_struct (LongStruct
*s
)
1720 return s
->i
+ s
->l
.l
;
1723 LIBTEST_API
void STDCALL
1724 mono_test_last_error (int err
)
1733 LIBTEST_API
int STDCALL
1734 mono_test_asany (void *ptr
, int what
)
1738 return (*(int*)ptr
== 5) ? 0 : 1;
1740 return strcmp (ptr
, "ABC") == 0 ? 0 : 1;
1742 simplestruct2 ss
= *(simplestruct2
*)ptr
;
1744 if (ss
.a
== 0 && ss
.b
== 1 && ss
.c
== 0 &&
1745 !strcmp (ss
.d
, "TEST") &&
1746 ss
.e
== 99 && ss
.f
== 1.5 && ss
.g
== 42 && ss
.h
== (guint64
)123)
1752 GError
*error
= NULL
;
1755 s
= g_utf16_to_utf8 ((const gunichar2
*)ptr
, -1, NULL
, NULL
, &error
);
1760 if (!strcmp (s
, "ABC")) {
1770 g_assert_not_reached ();
1784 LIBTEST_API
int STDCALL
1785 mono_test_marshal_asany_in (void* ptr
)
1787 AsAnyStruct
*asAny
= (AsAnyStruct
*)ptr
;
1788 int res
= asAny
->i
+ asAny
->j
+ asAny
->k
;
1793 LIBTEST_API
int STDCALL
1794 mono_test_marshal_asany_inout (void* ptr
)
1796 AsAnyStruct
*asAny
= (AsAnyStruct
*)ptr
;
1797 int res
= asAny
->i
+ asAny
->j
+ asAny
->k
;
1799 marshal_free (asAny
->s
);
1809 LIBTEST_API
int STDCALL
1810 mono_test_marshal_asany_out (void* ptr
)
1812 AsAnyStruct
*asAny
= (AsAnyStruct
*)ptr
;
1813 int res
= asAny
->i
+ asAny
->j
+ asAny
->k
;
1824 * AMD64 marshalling tests.
1827 typedef struct amd64_struct1
{
1834 LIBTEST_API amd64_struct1 STDCALL
1835 mono_test_marshal_amd64_pass_return_struct1 (amd64_struct1 s
)
1845 LIBTEST_API amd64_struct1 STDCALL
1846 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
)
1851 s
.l
+= 1 + i1
+ i2
+ i3
+ i4
+ i5
+ i6
+ i7
+ i8
;
1856 typedef struct amd64_struct2
{
1861 LIBTEST_API amd64_struct2 STDCALL
1862 mono_test_marshal_amd64_pass_return_struct2 (amd64_struct2 s
)
1870 typedef struct amd64_struct3
{
1874 LIBTEST_API amd64_struct3 STDCALL
1875 mono_test_marshal_amd64_pass_return_struct3 (amd64_struct3 s
)
1882 typedef struct amd64_struct4
{
1886 LIBTEST_API amd64_struct4 STDCALL
1887 mono_test_marshal_amd64_pass_return_struct4 (amd64_struct4 s
)
1896 * IA64 marshalling tests.
1898 typedef struct test_struct5
{
1902 LIBTEST_API test_struct5 STDCALL
1903 mono_test_marshal_ia64_pass_return_struct5 (double d1
, double d2
, test_struct5 s
, int i
, double d3
, double d4
)
1905 s
.d1
+= d1
+ d2
+ i
;
1906 s
.d2
+= d3
+ d4
+ i
;
1911 typedef struct test_struct6
{
1915 LIBTEST_API test_struct6 STDCALL
1916 mono_test_marshal_ia64_pass_return_struct6 (double d1
, double d2
, test_struct6 s
, int i
, double d3
, double d4
)
1918 s
.d1
+= d1
+ d2
+ i
;
1924 static guint32 custom_res
[2];
1926 LIBTEST_API
void* STDCALL
1927 mono_test_marshal_pass_return_custom (int i
, guint32
*ptr
, int j
)
1929 /* ptr will be freed by CleanupNative, so make a copy */
1930 custom_res
[0] = 0; /* not allocated by AllocHGlobal */
1931 custom_res
[1] = ptr
[1];
1936 LIBTEST_API
int STDCALL
1937 mono_test_marshal_pass_out_custom (int i
, guint32
**ptr
, int j
)
1940 custom_res
[1] = i
+ j
+ 10;
1947 LIBTEST_API
int STDCALL
1948 mono_test_marshal_pass_inout_custom (int i
, guint32
*ptr
, int j
)
1951 ptr
[1] = i
+ ptr
[1] + j
;
1956 LIBTEST_API
int STDCALL
1957 mono_test_marshal_pass_out_byval_custom (int i
, guint32
*ptr
, int j
)
1959 return ptr
== NULL
? 0 : 1;
1962 LIBTEST_API
int STDCALL
1963 mono_test_marshal_pass_byref_custom (int i
, guint32
**ptr
, int j
)
1970 LIBTEST_API
void* STDCALL
1971 mono_test_marshal_pass_return_custom2 (int i
, guint32
*ptr
, int j
)
1973 g_assert_not_reached ();
1978 LIBTEST_API
void* STDCALL
1979 mono_test_marshal_pass_return_custom_null (int i
, guint32
*ptr
, int j
)
1981 g_assert (ptr
== NULL
);
1986 typedef void *(STDCALL
*PassReturnPtrDelegate
) (void *ptr
);
1988 LIBTEST_API
int STDCALL
1989 mono_test_marshal_pass_return_custom_in_delegate (PassReturnPtrDelegate del
)
1998 ptr
= (guint32
*)del (&buf
);
2003 /* FIXME: Freed with FreeHGlobal */
2011 LIBTEST_API
int STDCALL
2012 mono_test_marshal_pass_return_custom_null_in_delegate (PassReturnPtrDelegate del
)
2014 void *ptr
= del (NULL
);
2016 return (ptr
== NULL
) ? 15 : 0;
2019 typedef void (STDCALL
*CustomOutParamDelegate
) (void **pptr
);
2021 LIBTEST_API
int STDCALL
2022 mono_test_marshal_custom_out_param_delegate (CustomOutParamDelegate del
)
2034 typedef int (STDCALL
*ReturnEnumDelegate
) (int e
);
2036 LIBTEST_API
int STDCALL
2037 mono_test_marshal_return_enum_delegate (ReturnEnumDelegate func
)
2047 typedef BlittableStruct (STDCALL
*SimpleDelegate10
) (BlittableStruct ss
);
2049 LIBTEST_API
int STDCALL
2050 mono_test_marshal_blittable_struct_delegate (SimpleDelegate10 delegate
)
2052 BlittableStruct ss
, res
;
2059 res
= delegate (ss
);
2060 if (! ((res
.a
== -1) && (res
.b
== -2) && (res
.c
== -3) && (res
.d
== -55)))
2066 LIBTEST_API
int STDCALL
2067 mono_test_stdcall_name_mangling (int a
, int b
, int c
)
2073 mono_test_stdcall_mismatch_1 (int a
, int b
, int c
)
2078 LIBTEST_API
int STDCALL
2079 mono_test_stdcall_mismatch_2 (int a
, int b
, int c
)
2085 * PASSING AND RETURNING SMALL STRUCTURES FROM DELEGATES TESTS
2092 typedef SmallStruct1 (STDCALL
*SmallStructDelegate1
) (SmallStruct1 ss
);
2094 LIBTEST_API
int STDCALL
2095 mono_test_marshal_small_struct_delegate1 (SmallStructDelegate1 delegate
)
2097 SmallStruct1 ss
, res
;
2101 res
= delegate (ss
);
2102 if (! (res
.i
== -1))
2112 typedef SmallStruct2 (STDCALL
*SmallStructDelegate2
) (SmallStruct2 ss
);
2114 LIBTEST_API
int STDCALL
2115 mono_test_marshal_small_struct_delegate2 (SmallStructDelegate2 delegate
)
2117 SmallStruct2 ss
, res
;
2122 res
= delegate (ss
);
2123 if (! ((res
.i
== -2) && (res
.j
== -3)))
2134 typedef SmallStruct3 (STDCALL
*SmallStructDelegate3
) (SmallStruct3 ss
);
2136 LIBTEST_API
int STDCALL
2137 mono_test_marshal_small_struct_delegate3 (SmallStructDelegate3 delegate
)
2139 SmallStruct3 ss
, res
;
2144 res
= delegate (ss
);
2145 if (! ((res
.i
== -1) && (res
.j
== -2)))
2155 typedef SmallStruct4 (STDCALL
*SmallStructDelegate4
) (SmallStruct4 ss
);
2157 LIBTEST_API
int STDCALL
2158 mono_test_marshal_small_struct_delegate4 (SmallStructDelegate4 delegate
)
2160 SmallStruct4 ss
, res
;
2164 res
= delegate (ss
);
2165 if (! (res
.i
== -1))
2175 typedef SmallStruct5 (STDCALL
*SmallStructDelegate5
) (SmallStruct5 ss
);
2177 LIBTEST_API
int STDCALL
2178 mono_test_marshal_small_struct_delegate5 (SmallStructDelegate5 delegate
)
2180 SmallStruct5 ss
, res
;
2184 res
= delegate (ss
);
2185 if (! (res
.i
== -5))
2195 typedef SmallStruct6 (STDCALL
*SmallStructDelegate6
) (SmallStruct6 ss
);
2197 LIBTEST_API
int STDCALL
2198 mono_test_marshal_small_struct_delegate6 (SmallStructDelegate6 delegate
)
2200 SmallStruct6 ss
, res
;
2205 res
= delegate (ss
);
2206 if (! ((res
.i
== -1) && (res
.j
== -2)))
2217 typedef SmallStruct7 (STDCALL
*SmallStructDelegate7
) (SmallStruct7 ss
);
2219 LIBTEST_API
int STDCALL
2220 mono_test_marshal_small_struct_delegate7 (SmallStructDelegate7 delegate
)
2222 SmallStruct7 ss
, res
;
2227 res
= delegate (ss
);
2228 if (! ((res
.i
== -1) && (res
.j
== -2)))
2238 typedef SmallStruct8 (STDCALL
*SmallStructDelegate8
) (SmallStruct8 ss
);
2240 LIBTEST_API
int STDCALL
2241 mono_test_marshal_small_struct_delegate8 (SmallStructDelegate8 delegate
)
2243 SmallStruct8 ss
, res
;
2247 res
= delegate (ss
);
2248 if (! ((res
.i
== -1.0)))
2258 typedef SmallStruct9 (STDCALL
*SmallStructDelegate9
) (SmallStruct9 ss
);
2260 LIBTEST_API
int STDCALL
2261 mono_test_marshal_small_struct_delegate9 (SmallStructDelegate9 delegate
)
2263 SmallStruct9 ss
, res
;
2267 res
= delegate (ss
);
2268 if (! ((res
.i
== -1.0)))
2278 typedef SmallStruct10 (STDCALL
*SmallStructDelegate10
) (SmallStruct10 ss
);
2280 LIBTEST_API
int STDCALL
2281 mono_test_marshal_small_struct_delegate10 (SmallStructDelegate10 delegate
)
2283 SmallStruct10 ss
, res
;
2288 res
= delegate (ss
);
2289 if (! ((res
.i
== -1.0) && (res
.j
== -2.0)))
2300 typedef SmallStruct11 (STDCALL
*SmallStructDelegate11
) (SmallStruct11 ss
);
2302 LIBTEST_API
int STDCALL
2303 mono_test_marshal_small_struct_delegate11 (SmallStructDelegate11 delegate
)
2305 SmallStruct11 ss
, res
;
2310 res
= delegate (ss
);
2311 if (! ((res
.i
== -1.0) && (res
.j
== -2)))
2317 typedef int (STDCALL
*ArrayDelegate
) (int i
, char *j
, void *arr
);
2319 LIBTEST_API
int STDCALL
2320 mono_test_marshal_array_delegate (void *arr
, int len
, ArrayDelegate del
)
2322 return del (len
, NULL
, arr
);
2325 typedef int (STDCALL
*ArrayDelegateLong
) (gint64 i
, char *j
, void *arr
);
2327 LIBTEST_API
int STDCALL
2328 mono_test_marshal_array_delegate_long (void *arr
, gint64 len
, ArrayDelegateLong del
)
2330 return del (len
, NULL
, arr
);
2333 LIBTEST_API
int STDCALL
2334 mono_test_marshal_out_array_delegate (int *arr
, int len
, ArrayDelegate del
)
2336 del (len
, NULL
, arr
);
2338 if ((arr
[0] != 1) || (arr
[1] != 2))
2344 typedef gunichar2
* (STDCALL
*UnicodeStringDelegate
) (gunichar2
*message
);
2346 LIBTEST_API
int STDCALL
2347 mono_test_marshal_return_unicode_string_delegate (UnicodeStringDelegate del
)
2349 const char m
[] = "abcdef";
2350 gunichar2
*s2
, *res
;
2353 s2
= g_utf8_to_utf16 (m
, -1, NULL
, &len
, NULL
);
2362 LIBTEST_API
int STDCALL
2363 mono_test_marshal_out_string_array_delegate (char **arr
, int len
, ArrayDelegate del
)
2365 del (len
, NULL
, arr
);
2367 if (!strcmp (arr
[0], "ABC") && !strcmp (arr
[1], "DEF"))
2373 typedef int (*CdeclDelegate
) (int i
, int j
);
2375 LIBTEST_API
int STDCALL
2376 mono_test_marshal_cdecl_delegate (CdeclDelegate del
)
2380 for (i
= 0; i
< 1000; ++i
)
2386 typedef char** (STDCALL
*ReturnStringArrayDelegate
) (int i
);
2388 LIBTEST_API
int STDCALL
2389 mono_test_marshal_return_string_array_delegate (ReturnStringArrayDelegate d
)
2397 if (strcmp (arr
[0], "ABC") || strcmp (arr
[1], "DEF"))
2407 typedef int (STDCALL
*ByrefStringDelegate
) (char **s
);
2409 LIBTEST_API
int STDCALL
2410 mono_test_marshal_byref_string_delegate (ByrefStringDelegate d
)
2412 char *s
= (char*)"ABC";
2419 if (!strcmp (s
, "DEF"))
2429 LIBTEST_API
int STDCALL
2430 add_delegate (int i
, int j
)
2435 LIBTEST_API gpointer STDCALL
2436 mono_test_marshal_return_fnptr (void)
2438 return &add_delegate
;
2441 LIBTEST_API
int STDCALL
2444 printf ("codigo %x\n", code
);
2452 LIBTEST_API HandleRef STDCALL
2453 mono_xr_as_handle (int code
)
2457 memset (&ref
, 0, sizeof (ref
));
2469 LIBTEST_API
int STDCALL
2470 mono_safe_handle_struct_ref (HandleStructs
*x
)
2472 printf ("Dingus Ref! \n");
2473 printf ("Values: %d %d %p %p\n", x
->a
, x
->b
, x
->handle1
, x
->handle2
);
2479 if (x
->handle1
!= (void*) 0x7080feed)
2482 if (x
->handle2
!= (void*) 0x1234abcd)
2488 LIBTEST_API
int STDCALL
2489 mono_safe_handle_struct (HandleStructs x
)
2491 printf ("Dingus Standard! \n");
2492 printf ("Values: %d %d %p %p\n", x
.a
, x
.b
, x
.handle1
, x
.handle2
);
2498 if (x
.handle1
!= (void*) 0x7080feed)
2501 if (x
.handle2
!= (void*) 0x1234abcd)
2511 LIBTEST_API
int STDCALL
2512 mono_safe_handle_struct_simple (TrivialHandle x
)
2514 printf ("The value is %p\n", x
.a
);
2515 return ((int)(gsize
)x
.a
) * 2;
2518 LIBTEST_API
int STDCALL
2519 mono_safe_handle_return (void)
2524 LIBTEST_API
void STDCALL
2525 mono_safe_handle_ref (void **handle
)
2528 *handle
= (void *) 0xbad;
2532 *handle
= (void *) 0x800d;
2535 LIBTEST_API
double STDCALL
2536 mono_test_marshal_date_time (double d
, double *d2
)
2608 VT_USERDEFINED
= 29,
2616 VT_STREAMED_OBJECT
= 68,
2617 VT_STORED_OBJECT
= 69,
2618 VT_BLOB_OBJECT
= 70,
2626 void VariantInit(VARIANT
* vt
)
2643 LIBTEST_API
int STDCALL
2644 mono_test_marshal_bstr_in(gunichar2
* bstr
)
2647 gchar
* bstr_utf8
= g_utf16_to_utf8 (bstr
, -1, NULL
, NULL
, NULL
);
2648 result
= strcmp("mono_test_marshal_bstr_in", bstr_utf8
);
2655 LIBTEST_API
int STDCALL
2656 mono_test_marshal_bstr_out(gunichar2
** bstr
)
2658 *bstr
= marshal_bstr_alloc ("mono_test_marshal_bstr_out");
2662 LIBTEST_API
int STDCALL
2663 mono_test_marshal_bstr_in_null(gunichar2
* bstr
)
2670 LIBTEST_API
int STDCALL
2671 mono_test_marshal_bstr_out_null(gunichar2
** bstr
)
2677 LIBTEST_API
int STDCALL
2678 mono_test_marshal_variant_in_sbyte(VARIANT variant
)
2680 if (variant
.vt
== VT_I1
&& variant
.cVal
== 100)
2685 LIBTEST_API
int STDCALL
2686 mono_test_marshal_variant_in_byte(VARIANT variant
)
2688 if (variant
.vt
== VT_UI1
&& variant
.bVal
== 100)
2693 LIBTEST_API
int STDCALL
2694 mono_test_marshal_variant_in_short(VARIANT variant
)
2696 if (variant
.vt
== VT_I2
&& variant
.iVal
== 314)
2701 LIBTEST_API
int STDCALL
2702 mono_test_marshal_variant_in_ushort(VARIANT variant
)
2704 if (variant
.vt
== VT_UI2
&& variant
.uiVal
== 314)
2709 LIBTEST_API
int STDCALL
2710 mono_test_marshal_variant_in_int(VARIANT variant
)
2712 if (variant
.vt
== VT_I4
&& variant
.lVal
== 314)
2717 LIBTEST_API
int STDCALL
2718 mono_test_marshal_variant_in_uint(VARIANT variant
)
2720 if (variant
.vt
== VT_UI4
&& variant
.ulVal
== 314)
2725 LIBTEST_API
int STDCALL
2726 mono_test_marshal_variant_in_long(VARIANT variant
)
2728 if (variant
.vt
== VT_I8
&& variant
.llVal
== 314)
2733 LIBTEST_API
int STDCALL
2734 mono_test_marshal_variant_in_ulong(VARIANT variant
)
2736 if (variant
.vt
== VT_UI8
&& variant
.ullVal
== 314)
2741 LIBTEST_API
int STDCALL
2742 mono_test_marshal_variant_in_float(VARIANT variant
)
2744 if (variant
.vt
== VT_R4
&& (variant
.fltVal
- 3.14)/3.14 < .001)
2749 LIBTEST_API
int STDCALL
2750 mono_test_marshal_variant_in_double(VARIANT variant
)
2752 if (variant
.vt
== VT_R8
&& (variant
.dblVal
- 3.14)/3.14 < .001)
2757 LIBTEST_API
int STDCALL
2758 mono_test_marshal_variant_in_bstr(VARIANT variant
)
2761 gchar
* bstr_utf8
= g_utf16_to_utf8 (variant
.bstrVal
, -1, NULL
, NULL
, NULL
);
2762 result
= strcmp("PI", bstr_utf8
);
2765 if (variant
.vt
== VT_BSTR
&& !result
)
2770 LIBTEST_API
int STDCALL
2771 mono_test_marshal_variant_in_bool_true (VARIANT variant
)
2773 if (variant
.vt
== VT_BOOL
&& variant
.boolVal
== VARIANT_TRUE
)
2778 LIBTEST_API
int STDCALL
2779 mono_test_marshal_variant_in_bool_false (VARIANT variant
)
2781 if (variant
.vt
== VT_BOOL
&& variant
.boolVal
== VARIANT_FALSE
)
2786 LIBTEST_API
int STDCALL
2787 mono_test_marshal_variant_out_sbyte(VARIANT
* variant
)
2789 variant
->vt
= VT_I1
;
2790 variant
->cVal
= 100;
2795 LIBTEST_API
int STDCALL
2796 mono_test_marshal_variant_out_sbyte_byref(VARIANT
* variant
)
2798 variant
->vt
= VT_I1
|VT_BYREF
;
2799 variant
->byref
= marshal_alloc(1);
2800 *((gint8
*)variant
->byref
) = 100;
2805 LIBTEST_API
int STDCALL
2806 mono_test_marshal_variant_out_byte(VARIANT
* variant
)
2808 variant
->vt
= VT_UI1
;
2809 variant
->bVal
= 100;
2814 LIBTEST_API
int STDCALL
2815 mono_test_marshal_variant_out_byte_byref(VARIANT
* variant
)
2817 variant
->vt
= VT_UI1
|VT_BYREF
;
2818 variant
->byref
= marshal_alloc(1);
2819 *((gint8
*)variant
->byref
) = 100;
2824 LIBTEST_API
int STDCALL
2825 mono_test_marshal_variant_out_short(VARIANT
* variant
)
2827 variant
->vt
= VT_I2
;
2828 variant
->iVal
= 314;
2833 LIBTEST_API
int STDCALL
2834 mono_test_marshal_variant_out_short_byref(VARIANT
* variant
)
2836 variant
->vt
= VT_I2
|VT_BYREF
;
2837 variant
->byref
= marshal_alloc(2);
2838 *((gint16
*)variant
->byref
) = 314;
2843 LIBTEST_API
int STDCALL
2844 mono_test_marshal_variant_out_ushort(VARIANT
* variant
)
2846 variant
->vt
= VT_UI2
;
2847 variant
->uiVal
= 314;
2852 LIBTEST_API
int STDCALL
2853 mono_test_marshal_variant_out_ushort_byref(VARIANT
* variant
)
2855 variant
->vt
= VT_UI2
|VT_BYREF
;
2856 variant
->byref
= marshal_alloc(2);
2857 *((guint16
*)variant
->byref
) = 314;
2862 LIBTEST_API
int STDCALL
2863 mono_test_marshal_variant_out_int(VARIANT
* variant
)
2865 variant
->vt
= VT_I4
;
2866 variant
->lVal
= 314;
2871 LIBTEST_API
int STDCALL
2872 mono_test_marshal_variant_out_int_byref(VARIANT
* variant
)
2874 variant
->vt
= VT_I4
|VT_BYREF
;
2875 variant
->byref
= marshal_alloc(4);
2876 *((gint32
*)variant
->byref
) = 314;
2881 LIBTEST_API
int STDCALL
2882 mono_test_marshal_variant_out_uint(VARIANT
* variant
)
2884 variant
->vt
= VT_UI4
;
2885 variant
->ulVal
= 314;
2890 LIBTEST_API
int STDCALL
2891 mono_test_marshal_variant_out_uint_byref(VARIANT
* variant
)
2893 variant
->vt
= VT_UI4
|VT_BYREF
;
2894 variant
->byref
= marshal_alloc(4);
2895 *((guint32
*)variant
->byref
) = 314;
2900 LIBTEST_API
int STDCALL
2901 mono_test_marshal_variant_out_long(VARIANT
* variant
)
2903 variant
->vt
= VT_I8
;
2904 variant
->llVal
= 314;
2909 LIBTEST_API
int STDCALL
2910 mono_test_marshal_variant_out_long_byref(VARIANT
* variant
)
2912 variant
->vt
= VT_I8
|VT_BYREF
;
2913 variant
->byref
= marshal_alloc(8);
2914 *((gint64
*)variant
->byref
) = 314;
2919 LIBTEST_API
int STDCALL
2920 mono_test_marshal_variant_out_ulong(VARIANT
* variant
)
2922 variant
->vt
= VT_UI8
;
2923 variant
->ullVal
= 314;
2928 LIBTEST_API
int STDCALL
2929 mono_test_marshal_variant_out_ulong_byref(VARIANT
* variant
)
2931 variant
->vt
= VT_UI8
|VT_BYREF
;
2932 variant
->byref
= marshal_alloc(8);
2933 *((guint64
*)variant
->byref
) = 314;
2938 LIBTEST_API
int STDCALL
2939 mono_test_marshal_variant_out_float(VARIANT
* variant
)
2941 variant
->vt
= VT_R4
;
2942 variant
->fltVal
= 3.14;
2947 LIBTEST_API
int STDCALL
2948 mono_test_marshal_variant_out_float_byref(VARIANT
* variant
)
2950 variant
->vt
= VT_R4
|VT_BYREF
;
2951 variant
->byref
= marshal_alloc(4);
2952 *((float*)variant
->byref
) = 3.14;
2957 LIBTEST_API
int STDCALL
2958 mono_test_marshal_variant_out_double(VARIANT
* variant
)
2960 variant
->vt
= VT_R8
;
2961 variant
->dblVal
= 3.14;
2966 LIBTEST_API
int STDCALL
2967 mono_test_marshal_variant_out_double_byref(VARIANT
* variant
)
2969 variant
->vt
= VT_R8
|VT_BYREF
;
2970 variant
->byref
= marshal_alloc(8);
2971 *((double*)variant
->byref
) = 3.14;
2976 LIBTEST_API
int STDCALL
2977 mono_test_marshal_variant_out_bstr(VARIANT
* variant
)
2979 variant
->vt
= VT_BSTR
;
2980 variant
->bstrVal
= marshal_bstr_alloc("PI");
2985 LIBTEST_API
int STDCALL
2986 mono_test_marshal_variant_out_bstr_byref(VARIANT
* variant
)
2988 variant
->vt
= VT_BSTR
|VT_BYREF
;
2989 variant
->byref
= marshal_alloc(sizeof(gpointer
));
2990 *((gunichar
**)variant
->byref
) = (gunichar
*)marshal_bstr_alloc("PI");
2995 LIBTEST_API
int STDCALL
2996 mono_test_marshal_variant_out_bool_true (VARIANT
* variant
)
2998 variant
->vt
= VT_BOOL
;
2999 variant
->boolVal
= VARIANT_TRUE
;
3004 LIBTEST_API
int STDCALL
3005 mono_test_marshal_variant_out_bool_true_byref (VARIANT
* variant
)
3007 variant
->vt
= VT_BOOL
|VT_BYREF
;
3008 variant
->byref
= marshal_alloc(2);
3009 *((gint16
*)variant
->byref
) = VARIANT_TRUE
;
3014 LIBTEST_API
int STDCALL
3015 mono_test_marshal_variant_out_bool_false (VARIANT
* variant
)
3017 variant
->vt
= VT_BOOL
;
3018 variant
->boolVal
= VARIANT_FALSE
;
3023 LIBTEST_API
int STDCALL
3024 mono_test_marshal_variant_out_bool_false_byref (VARIANT
* variant
)
3026 variant
->vt
= VT_BOOL
|VT_BYREF
;
3027 variant
->byref
= marshal_alloc(2);
3028 *((gint16
*)variant
->byref
) = VARIANT_FALSE
;
3033 typedef int (STDCALL
*VarFunc
) (int vt
, VARIANT variant
);
3034 typedef int (STDCALL
*VarRefFunc
) (int vt
, VARIANT
* variant
);
3036 LIBTEST_API
int STDCALL
3037 mono_test_marshal_variant_in_sbyte_unmanaged(VarFunc func
)
3042 return func (VT_I1
, vt
);
3045 LIBTEST_API
int STDCALL
3046 mono_test_marshal_variant_in_byte_unmanaged(VarFunc func
)
3051 return func (VT_UI1
, vt
);
3054 LIBTEST_API
int STDCALL
3055 mono_test_marshal_variant_in_short_unmanaged(VarFunc func
)
3060 return func (VT_I2
, vt
);
3063 LIBTEST_API
int STDCALL
3064 mono_test_marshal_variant_in_ushort_unmanaged(VarFunc func
)
3069 return func (VT_UI2
, vt
);
3072 LIBTEST_API
int STDCALL
3073 mono_test_marshal_variant_in_int_unmanaged(VarFunc func
)
3078 return func (VT_I4
, vt
);
3081 LIBTEST_API
int STDCALL
3082 mono_test_marshal_variant_in_uint_unmanaged(VarFunc func
)
3087 return func (VT_UI4
, vt
);
3090 LIBTEST_API
int STDCALL
3091 mono_test_marshal_variant_in_long_unmanaged(VarFunc func
)
3096 return func (VT_I8
, vt
);
3099 LIBTEST_API
int STDCALL
3100 mono_test_marshal_variant_in_ulong_unmanaged(VarFunc func
)
3105 return func (VT_UI8
, vt
);
3108 LIBTEST_API
int STDCALL
3109 mono_test_marshal_variant_in_float_unmanaged(VarFunc func
)
3114 return func (VT_R4
, vt
);
3117 LIBTEST_API
int STDCALL
3118 mono_test_marshal_variant_in_double_unmanaged(VarFunc func
)
3123 return func (VT_R8
, vt
);
3126 LIBTEST_API
int STDCALL
3127 mono_test_marshal_variant_in_bstr_unmanaged(VarFunc func
)
3131 vt
.bstrVal
= marshal_bstr_alloc("PI");
3132 return func (VT_BSTR
, vt
);
3135 LIBTEST_API
int STDCALL
3136 mono_test_marshal_variant_in_bool_true_unmanaged(VarFunc func
)
3140 vt
.boolVal
= VARIANT_TRUE
;
3141 return func (VT_BOOL
, vt
);
3144 LIBTEST_API
int STDCALL
3145 mono_test_marshal_variant_in_bool_false_unmanaged(VarFunc func
)
3149 vt
.boolVal
= VARIANT_FALSE
;
3150 return func (VT_BOOL
, vt
);
3153 LIBTEST_API
int STDCALL
3154 mono_test_marshal_variant_out_sbyte_unmanaged(VarRefFunc func
)
3159 if (vt
.vt
== VT_I1
&& vt
.cVal
== -100)
3164 LIBTEST_API
int STDCALL
3165 mono_test_marshal_variant_out_byte_unmanaged(VarRefFunc func
)
3170 if (vt
.vt
== VT_UI1
&& vt
.bVal
== 100)
3175 LIBTEST_API
int STDCALL
3176 mono_test_marshal_variant_out_short_unmanaged(VarRefFunc func
)
3181 if (vt
.vt
== VT_I2
&& vt
.iVal
== -100)
3186 LIBTEST_API
int STDCALL
3187 mono_test_marshal_variant_out_ushort_unmanaged(VarRefFunc func
)
3192 if (vt
.vt
== VT_UI2
&& vt
.uiVal
== 100)
3197 LIBTEST_API
int STDCALL
3198 mono_test_marshal_variant_out_int_unmanaged(VarRefFunc func
)
3203 if (vt
.vt
== VT_I4
&& vt
.lVal
== -100)
3208 LIBTEST_API
int STDCALL
3209 mono_test_marshal_variant_out_uint_unmanaged(VarRefFunc func
)
3214 if (vt
.vt
== VT_UI4
&& vt
.ulVal
== 100)
3219 LIBTEST_API
int STDCALL
3220 mono_test_marshal_variant_out_long_unmanaged(VarRefFunc func
)
3225 if (vt
.vt
== VT_I8
&& vt
.llVal
== -100)
3230 LIBTEST_API
int STDCALL
3231 mono_test_marshal_variant_out_ulong_unmanaged(VarRefFunc func
)
3236 if (vt
.vt
== VT_UI8
&& vt
.ullVal
== 100)
3241 LIBTEST_API
int STDCALL
3242 mono_test_marshal_variant_out_float_unmanaged(VarRefFunc func
)
3247 if (vt
.vt
== VT_R4
&& fabs (vt
.fltVal
- 3.14f
) < 1e-10)
3252 LIBTEST_API
int STDCALL
3253 mono_test_marshal_variant_out_double_unmanaged(VarRefFunc func
)
3258 if (vt
.vt
== VT_R8
&& fabs (vt
.dblVal
- 3.14) < 1e-10)
3263 LIBTEST_API
int STDCALL
3264 mono_test_marshal_variant_out_bstr_unmanaged(VarRefFunc func
)
3272 func (VT_BSTR
, &vt
);
3273 bstr_utf8
= g_utf16_to_utf8 (vt
.bstrVal
, -1, NULL
, NULL
, NULL
);
3274 result
= strcmp("PI", bstr_utf8
);
3276 if (vt
.vt
== VT_BSTR
&& !result
)
3281 LIBTEST_API
int STDCALL
3282 mono_test_marshal_variant_out_bool_true_unmanaged(VarRefFunc func
)
3286 func (VT_BOOL
, &vt
);
3287 if (vt
.vt
== VT_BOOL
&& vt
.boolVal
== VARIANT_TRUE
)
3292 LIBTEST_API
int STDCALL
3293 mono_test_marshal_variant_out_bool_false_unmanaged(VarRefFunc func
)
3297 func (VT_BOOL
, &vt
);
3298 if (vt
.vt
== VT_BOOL
&& vt
.boolVal
== VARIANT_TRUE
)
3303 typedef struct MonoComObject MonoComObject
;
3307 int (STDCALL
*QueryInterface
)(MonoComObject
* pUnk
, gpointer riid
, gpointer
* ppv
);
3308 int (STDCALL
*AddRef
)(MonoComObject
* pUnk
);
3309 int (STDCALL
*Release
)(MonoComObject
* pUnk
);
3310 int (STDCALL
*get_ITest
)(MonoComObject
* pUnk
, MonoComObject
* *ppUnk
);
3311 int (STDCALL
*SByteIn
)(MonoComObject
* pUnk
, char a
);
3312 int (STDCALL
*ByteIn
)(MonoComObject
* pUnk
, unsigned char a
);
3313 int (STDCALL
*ShortIn
)(MonoComObject
* pUnk
, short a
);
3314 int (STDCALL
*UShortIn
)(MonoComObject
* pUnk
, unsigned short a
);
3315 int (STDCALL
*IntIn
)(MonoComObject
* pUnk
, int a
);
3316 int (STDCALL
*UIntIn
)(MonoComObject
* pUnk
, unsigned int a
);
3317 int (STDCALL
*LongIn
)(MonoComObject
* pUnk
, gint64 a
);
3318 int (STDCALL
*ULongIn
)(MonoComObject
* pUnk
, guint64 a
);
3319 int (STDCALL
*FloatIn
)(MonoComObject
* pUnk
, float a
);
3320 int (STDCALL
*DoubleIn
)(MonoComObject
* pUnk
, double a
);
3321 int (STDCALL
*ITestIn
)(MonoComObject
* pUnk
, MonoComObject
* pUnk2
);
3322 int (STDCALL
*ITestOut
)(MonoComObject
* pUnk
, MonoComObject
* *ppUnk
);
3325 struct MonoComObject
3331 static GUID IID_ITest
= {0, 0, 0, {0,0,0,0,0,0,0,1}};
3332 static GUID IID_IMonoUnknown
= {0, 0, 0, {0xc0,0,0,0,0,0,0,0x46}};
3333 static GUID IID_IMonoDispatch
= {0x00020400, 0, 0, {0xc0,0,0,0,0,0,0,0x46}};
3335 LIBTEST_API
int STDCALL
3336 MonoQueryInterface(MonoComObject
* pUnk
, gpointer riid
, gpointer
* ppv
)
3340 if (!memcmp(riid
, &IID_IMonoUnknown
, sizeof(GUID
))) {
3344 else if (!memcmp(riid
, &IID_ITest
, sizeof(GUID
))) {
3348 else if (!memcmp(riid
, &IID_IMonoDispatch
, sizeof(GUID
))) {
3352 return 0x80004002; //E_NOINTERFACE;
3355 LIBTEST_API
int STDCALL
3356 MonoAddRef(MonoComObject
* pUnk
)
3358 return ++(pUnk
->m_ref
);
3361 LIBTEST_API
int STDCALL
3362 MonoRelease(MonoComObject
* pUnk
)
3364 return --(pUnk
->m_ref
);
3367 LIBTEST_API
int STDCALL
3368 SByteIn(MonoComObject
* pUnk
, char a
)
3373 LIBTEST_API
int STDCALL
3374 ByteIn(MonoComObject
* pUnk
, unsigned char a
)
3379 LIBTEST_API
int STDCALL
3380 ShortIn(MonoComObject
* pUnk
, short a
)
3385 LIBTEST_API
int STDCALL
3386 UShortIn(MonoComObject
* pUnk
, unsigned short a
)
3391 LIBTEST_API
int STDCALL
3392 IntIn(MonoComObject
* pUnk
, int a
)
3397 LIBTEST_API
int STDCALL
3398 UIntIn(MonoComObject
* pUnk
, unsigned int a
)
3403 LIBTEST_API
int STDCALL
3404 LongIn(MonoComObject
* pUnk
, gint64 a
)
3409 LIBTEST_API
int STDCALL
3410 ULongIn(MonoComObject
* pUnk
, guint64 a
)
3415 LIBTEST_API
int STDCALL
3416 FloatIn(MonoComObject
* pUnk
, float a
)
3421 LIBTEST_API
int STDCALL
3422 DoubleIn(MonoComObject
* pUnk
, double a
)
3427 LIBTEST_API
int STDCALL
3428 ITestIn(MonoComObject
* pUnk
, MonoComObject
*pUnk2
)
3433 LIBTEST_API
int STDCALL
3434 ITestOut(MonoComObject
* pUnk
, MonoComObject
* *ppUnk
)
3439 static void create_com_object (MonoComObject
** pOut
);
3441 LIBTEST_API
int STDCALL
3442 get_ITest(MonoComObject
* pUnk
, MonoComObject
* *ppUnk
)
3444 create_com_object (ppUnk
);
3448 static void create_com_object (MonoComObject
** pOut
)
3450 *pOut
= marshal_new0 (MonoComObject
, 1);
3451 (*pOut
)->vtbl
= marshal_new0 (MonoIUnknown
, 1);
3454 (*pOut
)->vtbl
->QueryInterface
= MonoQueryInterface
;
3455 (*pOut
)->vtbl
->AddRef
= MonoAddRef
;
3456 (*pOut
)->vtbl
->Release
= MonoRelease
;
3457 (*pOut
)->vtbl
->SByteIn
= SByteIn
;
3458 (*pOut
)->vtbl
->ByteIn
= ByteIn
;
3459 (*pOut
)->vtbl
->ShortIn
= ShortIn
;
3460 (*pOut
)->vtbl
->UShortIn
= UShortIn
;
3461 (*pOut
)->vtbl
->IntIn
= IntIn
;
3462 (*pOut
)->vtbl
->UIntIn
= UIntIn
;
3463 (*pOut
)->vtbl
->LongIn
= LongIn
;
3464 (*pOut
)->vtbl
->ULongIn
= ULongIn
;
3465 (*pOut
)->vtbl
->FloatIn
= FloatIn
;
3466 (*pOut
)->vtbl
->DoubleIn
= DoubleIn
;
3467 (*pOut
)->vtbl
->ITestIn
= ITestIn
;
3468 (*pOut
)->vtbl
->ITestOut
= ITestOut
;
3469 (*pOut
)->vtbl
->get_ITest
= get_ITest
;
3472 static MonoComObject
* same_object
= NULL
;
3474 LIBTEST_API
int STDCALL
3475 mono_test_marshal_com_object_create(MonoComObject
* *pUnk
)
3477 create_com_object (pUnk
);
3480 same_object
= *pUnk
;
3485 LIBTEST_API
int STDCALL
3486 mono_test_marshal_com_object_same(MonoComObject
* *pUnk
)
3488 *pUnk
= same_object
;
3493 LIBTEST_API
int STDCALL
3494 mono_test_marshal_com_object_destroy(MonoComObject
*pUnk
)
3496 int ref
= --(pUnk
->m_ref
);
3503 LIBTEST_API
int STDCALL
3504 mono_test_marshal_com_object_ref_count(MonoComObject
*pUnk
)
3509 LIBTEST_API
int STDCALL
3510 mono_test_marshal_ccw_itest (MonoComObject
*pUnk
)
3513 MonoComObject
* pTest
;
3518 hr
= pUnk
->vtbl
->SByteIn (pUnk
, -100);
3521 hr
= pUnk
->vtbl
->ByteIn (pUnk
, 100);
3524 hr
= pUnk
->vtbl
->ShortIn (pUnk
, -100);
3527 hr
= pUnk
->vtbl
->UShortIn (pUnk
, 100);
3530 hr
= pUnk
->vtbl
->IntIn (pUnk
, -100);
3533 hr
= pUnk
->vtbl
->UIntIn (pUnk
, 100);
3536 hr
= pUnk
->vtbl
->LongIn (pUnk
, -100);
3539 hr
= pUnk
->vtbl
->ULongIn (pUnk
, 100);
3542 hr
= pUnk
->vtbl
->FloatIn (pUnk
, 3.14f
);
3545 hr
= pUnk
->vtbl
->DoubleIn (pUnk
, 3.14);
3548 hr
= pUnk
->vtbl
->ITestIn (pUnk
, pUnk
);
3551 hr
= pUnk
->vtbl
->ITestOut (pUnk
, &pTest
);
3559 * mono_method_get_unmanaged_thunk tests
3562 #if defined(__GNUC__) && ((defined(__i386__) && (defined(__linux__) || defined (__APPLE__)) || defined (__FreeBSD__) || defined(__OpenBSD__)) || (defined(__ppc__) && defined(__APPLE__)))
3563 #define ALIGN(size) __attribute__ ((aligned(size)))
3569 /* thunks.cs:TestStruct */
3570 typedef struct _TestStruct
{
3575 /* Searches for mono symbols in all loaded modules */
3577 lookup_mono_symbol (const char *symbol_name
)
3580 if (g_module_symbol (g_module_open (NULL
, G_MODULE_BIND_LAZY
), symbol_name
, &symbol
))
3586 LIBTEST_API gpointer STDCALL
3587 mono_test_marshal_lookup_symbol (const char *symbol_name
)
3589 return lookup_mono_symbol (symbol_name
);
3592 #define MONO_BEGIN_EFRAME { void *__dummy; void *__region_cookie = mono_threads_enter_gc_unsafe_region ? mono_threads_enter_gc_unsafe_region (&__dummy) : NULL;
3593 #define MONO_END_EFRAME if (mono_threads_exit_gc_unsafe_region) mono_threads_exit_gc_unsafe_region (__region_cookie, &__dummy); }
3596 * test_method_thunk:
3598 * @test_id: the test number
3599 * @test_method_handle: MonoMethod* of the C# test method
3600 * @create_object_method_handle: MonoMethod* of thunks.cs:Test.CreateObject
3602 LIBTEST_API
int STDCALL
3603 test_method_thunk (int test_id
, gpointer test_method_handle
, gpointer create_object_method_handle
)
3607 gpointer (*mono_method_get_unmanaged_thunk
)(gpointer
)
3608 = (gpointer (*)(gpointer
))lookup_mono_symbol ("mono_method_get_unmanaged_thunk");
3610 gpointer (*mono_string_new_wrapper
)(const char *)
3611 = (gpointer (*)(const char *))lookup_mono_symbol ("mono_string_new_wrapper");
3613 char *(*mono_string_to_utf8
)(gpointer
)
3614 = (char *(*)(gpointer
))lookup_mono_symbol ("mono_string_to_utf8");
3616 gpointer (*mono_object_unbox
)(gpointer
)
3617 = (gpointer (*)(gpointer
))lookup_mono_symbol ("mono_object_unbox");
3619 gpointer (*mono_threads_enter_gc_unsafe_region
) (gpointer
)
3620 = (gpointer (*)(gpointer
))lookup_mono_symbol ("mono_threads_enter_gc_unsafe_region");
3622 void (*mono_threads_exit_gc_unsafe_region
) (gpointer
, gpointer
)
3623 = (void (*)(gpointer
, gpointer
))lookup_mono_symbol ("mono_threads_exit_gc_unsafe_region");
3627 gpointer test_method
, ex
= NULL
;
3628 gpointer (STDCALL
*CreateObject
)(gpointer
*);
3632 if (!mono_method_get_unmanaged_thunk
) {
3637 test_method
= mono_method_get_unmanaged_thunk (test_method_handle
);
3643 CreateObject
= (gpointer (STDCALL
*)(gpointer
*))mono_method_get_unmanaged_thunk (create_object_method_handle
);
3644 if (!CreateObject
) {
3653 /* thunks.cs:Test.Test0 */
3654 void (STDCALL
*F
)(gpointer
*) = (void (STDCALL
*)(gpointer
*))test_method
;
3660 /* thunks.cs:Test.Test1 */
3661 int (STDCALL
*F
)(gpointer
*) = (int (STDCALL
*)(gpointer
*))test_method
;
3662 if (F (&ex
) != 42) {
3670 /* thunks.cs:Test.Test2 */
3671 gpointer (STDCALL
*F
)(gpointer
, gpointer
*) = (gpointer (STDCALL
*)(gpointer
, gpointer
*))test_method
;
3672 gpointer str
= mono_string_new_wrapper ("foo");
3673 if (str
!= F (str
, &ex
)) {
3681 /* thunks.cs:Test.Test3 */
3682 gpointer (STDCALL
*F
)(gpointer
, gpointer
, gpointer
*);
3686 F
= (gpointer (STDCALL
*)(gpointer
, gpointer
, gpointer
*))test_method
;
3687 obj
= CreateObject (&ex
);
3688 str
= mono_string_new_wrapper ("bar");
3690 if (str
!= F (obj
, str
, &ex
)) {
3698 /* thunks.cs:Test.Test4 */
3699 int (STDCALL
*F
)(gpointer
, gpointer
, int, gpointer
*);
3703 F
= (int (STDCALL
*)(gpointer
, gpointer
, int, gpointer
*))test_method
;
3704 obj
= CreateObject (&ex
);
3705 str
= mono_string_new_wrapper ("bar");
3707 if (42 != F (obj
, str
, 42, &ex
)) {
3716 /* thunks.cs:Test.Test5 */
3717 int (STDCALL
*F
)(gpointer
, gpointer
, int, gpointer
*);
3721 F
= (int (STDCALL
*)(gpointer
, gpointer
, int, gpointer
*))test_method
;
3722 obj
= CreateObject (&ex
);
3723 str
= mono_string_new_wrapper ("bar");
3725 F (obj
, str
, 42, &ex
);
3735 /* thunks.cs:Test.Test6 */
3736 int (STDCALL
*F
)(gpointer
, guint8
, gint16
, gint32
, gint64
, float, double,
3737 gpointer
, gpointer
*);
3739 gpointer str
= mono_string_new_wrapper ("Test6");
3742 F
= (int (STDCALL
*)(gpointer
, guint8
, gint16
, gint32
, gint64
, float, double, gpointer
, gpointer
*))test_method
;
3743 obj
= CreateObject (&ex
);
3745 res
= F (obj
, 254, 32700, -245378, 6789600, 3.1415, 3.1415, str
, &ex
);
3760 /* thunks.cs:Test.Test7 */
3761 gint64 (STDCALL
*F
)(gpointer
*) = (gint64 (STDCALL
*)(gpointer
*))test_method
;
3762 if (F (&ex
) != G_MAXINT64
) {
3770 /* thunks.cs:Test.Test8 */
3771 void (STDCALL
*F
)(guint8
*, gint16
*, gint32
*, gint64
*, float*, double*,
3772 gpointer
*, gpointer
*);
3782 F
= (void (STDCALL
*)(guint8
*, gint16
*, gint32
*, gint64
*, float *, double *,
3783 gpointer
*, gpointer
*))test_method
;
3785 F (&a1
, &a2
, &a3
, &a4
, &a5
, &a6
, &a7
, &ex
);
3795 (fabs (a5
- 3.1415) < 0.001) &&
3796 (fabs (a6
- 3.1415) < 0.001) &&
3797 strcmp (mono_string_to_utf8 (a7
), "Test8") == 0)){
3806 /* thunks.cs:Test.Test9 */
3807 void (STDCALL
*F
)(guint8
*, gint16
*, gint32
*, gint64
*, float*, double*,
3808 gpointer
*, gpointer
*);
3818 F
= (void (STDCALL
*)(guint8
*, gint16
*, gint32
*, gint64
*, float *, double *,
3819 gpointer
*, gpointer
*))test_method
;
3821 F (&a1
, &a2
, &a3
, &a4
, &a5
, &a6
, &a7
, &ex
);
3831 /* thunks.cs:Test.Test10 */
3832 void (STDCALL
*F
)(gpointer
*, gpointer
*);
3834 gpointer obj1
, obj2
;
3836 obj1
= obj2
= CreateObject (&ex
);
3842 F
= (void (STDCALL
*)(gpointer
*, gpointer
*))test_method
;
3859 /* thunks.cs:TestStruct.Test0 */
3860 int (STDCALL
*F
)(gpointer
*, gpointer
*);
3866 obj
= CreateObject (&ex
);
3877 a1
= (TestStruct
*)mono_object_unbox (obj
);
3886 F
= (int (STDCALL
*)(gpointer
*, gpointer
*))test_method
;
3888 res
= F ((gpointer
*)obj
, &ex
);
3899 /* check whether the call was really by value */
3900 if (a1
->A
!= 42 || a1
->B
!= 3.1415) {
3909 /* thunks.cs:TestStruct.Test1 */
3910 void (STDCALL
*F
)(gpointer
, gpointer
*);
3915 obj
= CreateObject (&ex
);
3926 a1
= (TestStruct
*)mono_object_unbox (obj
);
3932 F
= (void (STDCALL
*)(gpointer
, gpointer
*))test_method
;
3945 if (!(fabs (a1
->B
- 3.1415) < 0.001)) {
3954 /* thunks.cs:TestStruct.Test2 */
3955 gpointer (STDCALL
*F
)(gpointer
*);
3960 F
= (gpointer (STDCALL
*)(gpointer
*))test_method
;
3973 a1
= (TestStruct
*)mono_object_unbox (obj
);
3980 if (!(fabs (a1
->B
- 3.1415) < 0.001)) {
3989 /* thunks.cs:TestStruct.Test3 */
3990 void (STDCALL
*F
)(gpointer
, gpointer
*);
3995 obj
= CreateObject (&ex
);
4006 a1
= (TestStruct
*)mono_object_unbox (obj
);
4016 F
= (void (STDCALL
*)(gpointer
, gpointer
*))test_method
;
4052 LIBTEST_API
int STDCALL
4053 mono_test_Winx64_struct1_in (winx64_struct1 var
)
4066 LIBTEST_API
int STDCALL
4067 mono_test_Winx64_struct2_in (winx64_struct2 var
)
4084 LIBTEST_API
int STDCALL
4085 mono_test_Winx64_struct3_in (winx64_struct3 var
)
4091 if (var
.c
!= 0x1234)
4104 LIBTEST_API
int STDCALL
4105 mono_test_Winx64_struct4_in (winx64_struct4 var
)
4111 if (var
.c
!= 0x1234)
4113 if (var
.d
!= 0x87654321)
4125 LIBTEST_API
int STDCALL
4126 mono_test_Winx64_struct5_in (winx64_struct5 var
)
4144 LIBTEST_API
int STDCALL
4145 mono_test_Winx64_struct6_in (winx64_struct6 var
)
4156 LIBTEST_API
int STDCALL
4157 mono_test_Winx64_structs_in1 (winx64_struct1 var1
,
4158 winx64_struct2 var2
,
4159 winx64_struct3 var3
,
4160 winx64_struct4 var4
)
4174 if (var3
.c
!= 0x1234)
4181 if (var4
.c
!= 0x1234)
4183 if (var4
.d
!= 0x87654321)
4188 LIBTEST_API
int STDCALL
4189 mono_test_Winx64_structs_in2 (winx64_struct1 var1
,
4190 winx64_struct1 var2
,
4191 winx64_struct1 var3
,
4192 winx64_struct1 var4
,
4193 winx64_struct1 var5
)
4209 LIBTEST_API
int STDCALL
4210 mono_test_Winx64_structs_in3 (winx64_struct1 var1
,
4211 winx64_struct5 var2
,
4212 winx64_struct1 var3
,
4213 winx64_struct5 var4
,
4214 winx64_struct1 var5
,
4215 winx64_struct5 var6
)
4250 LIBTEST_API winx64_struct1 STDCALL
4251 mono_test_Winx64_struct1_ret (void)
4258 LIBTEST_API winx64_struct2 STDCALL
4259 mono_test_Winx64_struct2_ret (void)
4267 LIBTEST_API winx64_struct3 STDCALL
4268 mono_test_Winx64_struct3_ret (void)
4277 LIBTEST_API winx64_struct4 STDCALL
4278 mono_test_Winx64_struct4_ret (void)
4288 LIBTEST_API winx64_struct5 STDCALL
4289 mono_test_Winx64_struct5_ret (void)
4298 LIBTEST_API winx64_struct1 STDCALL
4299 mono_test_Winx64_struct1_ret_5_args (char a
, char b
, char c
, char d
, char e
)
4302 ret
.a
= a
+ b
+ c
+ d
+ e
;
4306 LIBTEST_API winx64_struct5 STDCALL
4307 mono_test_Winx64_struct5_ret6_args (char a
, char b
, char c
, char d
, char e
)
4320 } winx64_floatStruct
;
4322 LIBTEST_API
int STDCALL
4323 mono_test_Winx64_floatStruct (winx64_floatStruct a
)
4325 if (a
.a
> 5.6 || a
.a
< 5.4)
4328 if (a
.b
> 9.6 || a
.b
< 9.4)
4337 } winx64_doubleStruct
;
4339 LIBTEST_API
int STDCALL
4340 mono_test_Winx64_doubleStruct (winx64_doubleStruct a
)
4342 if (a
.a
> 5.6 || a
.a
< 5.4)
4348 typedef int (STDCALL
*managed_struct1_delegate
) (winx64_struct1 a
);
4350 LIBTEST_API
int STDCALL
4351 mono_test_managed_Winx64_struct1_in(managed_struct1_delegate func
)
4358 typedef int (STDCALL
*managed_struct5_delegate
) (winx64_struct5 a
);
4360 LIBTEST_API
int STDCALL
4361 mono_test_managed_Winx64_struct5_in(managed_struct5_delegate func
)
4370 typedef int (STDCALL
*managed_struct1_struct5_delegate
) (winx64_struct1 a
, winx64_struct5 b
,
4371 winx64_struct1 c
, winx64_struct5 d
,
4372 winx64_struct1 e
, winx64_struct5 f
);
4374 LIBTEST_API
int STDCALL
4375 mono_test_managed_Winx64_struct1_struct5_in(managed_struct1_struct5_delegate func
)
4377 winx64_struct1 a
, c
, e
;
4378 winx64_struct5 b
, d
, f
;
4380 b
.a
= 2; b
.b
= 3; b
.c
= 4;
4382 d
.a
= 6; d
.b
= 7; d
.c
= 8;
4384 f
.a
= 10; f
.b
= 11; f
.c
= 12;
4386 return func (a
, b
, c
, d
, e
, f
);
4389 typedef winx64_struct1 (STDCALL
*managed_struct1_ret_delegate
) (void);
4391 LIBTEST_API
int STDCALL
4392 mono_test_Winx64_struct1_ret_managed (managed_struct1_ret_delegate func
)
4404 typedef winx64_struct5 (STDCALL
*managed_struct5_ret_delegate
) (void);
4406 LIBTEST_API
int STDCALL
4407 mono_test_Winx64_struct5_ret_managed (managed_struct5_ret_delegate func
)
4423 LIBTEST_API
int STDCALL
4424 mono_test_marshal_bool_in (int arg
, unsigned int expected
, unsigned int bDefaultMarsh
, unsigned int bBoolCustMarsh
,
4425 char bI1CustMarsh
, unsigned char bU1CustMarsh
, short bVBCustMarsh
)
4429 if (bDefaultMarsh
!= expected
)
4433 if (bBoolCustMarsh
!= expected
)
4437 if (bI1CustMarsh
!= expected
)
4441 if (bU1CustMarsh
!= expected
)
4445 if (bVBCustMarsh
!= expected
)
4454 LIBTEST_API
int STDCALL
4455 mono_test_marshal_bool_out (int arg
, unsigned int testVal
, unsigned int* bDefaultMarsh
, unsigned int* bBoolCustMarsh
,
4456 char* bI1CustMarsh
, unsigned char* bU1CustMarsh
, unsigned short* bVBCustMarsh
)
4462 *bDefaultMarsh
= testVal
;
4465 if (!bBoolCustMarsh
)
4467 *bBoolCustMarsh
= testVal
;
4472 *bI1CustMarsh
= (char)testVal
;
4477 *bU1CustMarsh
= (unsigned char)testVal
;
4482 *bVBCustMarsh
= (unsigned short)testVal
;
4490 LIBTEST_API
int STDCALL
4491 mono_test_marshal_bool_ref (int arg
, unsigned int expected
, unsigned int testVal
, unsigned int* bDefaultMarsh
,
4492 unsigned int* bBoolCustMarsh
, char* bI1CustMarsh
, unsigned char* bU1CustMarsh
,
4493 unsigned short* bVBCustMarsh
)
4499 if (*bDefaultMarsh
!= expected
)
4501 *bDefaultMarsh
= testVal
;
4504 if (!bBoolCustMarsh
)
4506 if (*bBoolCustMarsh
!= expected
)
4508 *bBoolCustMarsh
= testVal
;
4513 if (*bI1CustMarsh
!= expected
)
4515 *bI1CustMarsh
= (char)testVal
;
4520 if (*bU1CustMarsh
!= expected
)
4522 *bU1CustMarsh
= (unsigned char)testVal
;
4527 if (*bVBCustMarsh
!= expected
)
4529 *bVBCustMarsh
= (unsigned short)testVal
;
4538 typedef int (STDCALL
*MarshalBoolInDelegate
) (int arg
, unsigned int expected
, unsigned int bDefaultMarsh
,
4539 unsigned int bBoolCustMarsh
, char bI1CustMarsh
, unsigned char bU1CustMarsh
, unsigned short bVBCustMarsh
);
4541 LIBTEST_API
int STDCALL
4542 mono_test_managed_marshal_bool_in (int arg
, unsigned int expected
, unsigned int testVal
, MarshalBoolInDelegate pfcn
)
4549 return pfcn (arg
, expected
, testVal
, 0, 0, 0, 0);
4551 return pfcn (arg
, expected
, 0, testVal
, 0, 0, 0);
4553 return pfcn (arg
, expected
, 0, 0, testVal
, 0, 0);
4555 return pfcn (arg
, expected
, 0, 0, 0, testVal
, 0);
4557 return pfcn (arg
, expected
, 0, 0, 0, 0, testVal
);
4565 typedef int (STDCALL
*MarshalBoolOutDelegate
) (int arg
, unsigned int expected
, unsigned int* bDefaultMarsh
,
4566 unsigned int* bBoolCustMarsh
, char* bI1CustMarsh
, unsigned char* bU1CustMarsh
, unsigned short* bVBCustMarsh
);
4568 LIBTEST_API
int STDCALL
4569 mono_test_managed_marshal_bool_out (int arg
, unsigned int expected
, unsigned int testVal
, MarshalBoolOutDelegate pfcn
)
4572 unsigned int lDefaultMarsh
, lBoolCustMarsh
;
4573 char lI1CustMarsh
= 0;
4574 unsigned char lU1CustMarsh
= 0;
4575 unsigned short lVBCustMarsh
= 0;
4576 lDefaultMarsh
= lBoolCustMarsh
= 0;
4583 unsigned int ltVal
= 0;
4584 ret
= pfcn (arg
, testVal
, <Val
, &lBoolCustMarsh
, &lI1CustMarsh
, &lU1CustMarsh
, &lVBCustMarsh
);
4586 return 0x0100 + ret
;
4587 if (expected
!= ltVal
)
4592 unsigned int ltVal
= 0;
4593 ret
= pfcn (arg
, testVal
, &lDefaultMarsh
, <Val
, &lI1CustMarsh
, &lU1CustMarsh
, &lVBCustMarsh
);
4595 return 0x0300 + ret
;
4596 if (expected
!= ltVal
)
4602 ret
= pfcn (arg
, testVal
, &lDefaultMarsh
, &lBoolCustMarsh
, <Val
, &lU1CustMarsh
, &lVBCustMarsh
);
4604 return 0x0500 + ret
;
4605 if (expected
!= ltVal
)
4610 unsigned char ltVal
= 0;
4611 ret
= pfcn (arg
, testVal
, &lDefaultMarsh
, &lBoolCustMarsh
, &lI1CustMarsh
, <Val
, &lVBCustMarsh
);
4613 return 0x0700 + ret
;
4614 if (expected
!= ltVal
)
4619 unsigned short ltVal
= 0;
4620 ret
= pfcn (arg
, testVal
, &lDefaultMarsh
, &lBoolCustMarsh
, &lI1CustMarsh
, &lU1CustMarsh
, <Val
);
4622 return 0x0900 + ret
;
4623 if (expected
!= ltVal
)
4634 typedef int (STDCALL
*MarshalBoolRefDelegate
) (int arg
, unsigned int expected
, unsigned int testVal
, unsigned int* bDefaultMarsh
,
4635 unsigned int* bBoolCustMarsh
, char* bI1CustMarsh
, unsigned char* bU1CustMarsh
, unsigned short* bVBCustMarsh
);
4637 LIBTEST_API
int STDCALL
4638 mono_test_managed_marshal_bool_ref (int arg
, unsigned int expected
, unsigned int testVal
, unsigned int outExpected
,
4639 unsigned int outTestVal
, MarshalBoolRefDelegate pfcn
)
4642 unsigned int lDefaultMarsh
, lBoolCustMarsh
;
4643 char lI1CustMarsh
= 0;
4644 unsigned char lU1CustMarsh
= 0;
4645 unsigned short lVBCustMarsh
= 0;
4646 lDefaultMarsh
= lBoolCustMarsh
= 0;
4654 unsigned int ltestVal
= testVal
;
4655 ret
= pfcn (arg
, expected
, outTestVal
, <estVal
, &lBoolCustMarsh
, &lI1CustMarsh
, &lU1CustMarsh
, &lVBCustMarsh
);
4657 return 0x0100 + ret
;
4658 if (outExpected
!= ltestVal
)
4664 unsigned int ltestVal
= testVal
;
4665 ret
= pfcn (arg
, expected
, outTestVal
, &lDefaultMarsh
, <estVal
, &lI1CustMarsh
, &lU1CustMarsh
, &lVBCustMarsh
);
4667 return 0x0300 + ret
;
4668 if (outExpected
!= ltestVal
)
4674 char ltestVal
= testVal
;
4675 ret
= pfcn (arg
, expected
, outTestVal
, &lDefaultMarsh
, &lBoolCustMarsh
, <estVal
, &lU1CustMarsh
, &lVBCustMarsh
);
4677 return 0x0500 + ret
;
4678 if (outExpected
!= ltestVal
)
4684 unsigned char ltestVal
= testVal
;
4685 ret
= pfcn (arg
, expected
, outTestVal
, &lDefaultMarsh
, &lBoolCustMarsh
, &lI1CustMarsh
, <estVal
, &lVBCustMarsh
);
4687 return 0x0700 + ret
;
4688 if (outExpected
!= ltestVal
)
4694 unsigned short ltestVal
= testVal
;
4695 ret
= pfcn (arg
, expected
, outTestVal
, &lDefaultMarsh
, &lBoolCustMarsh
, &lI1CustMarsh
, &lU1CustMarsh
, <estVal
);
4697 return 0x0900 + ret
;
4698 if (outExpected
!= ltestVal
)
4711 LIBTEST_API
int STDCALL
4712 mono_test_marshal_safearray_out_1dim_vt_bstr_empty (SAFEARRAY
** safearray
)
4714 /* Create an empty one-dimensional array of variants */
4716 SAFEARRAYBOUND dimensions
[1];
4718 dimensions
[0].lLbound
= 0;
4719 dimensions
[0].cElements
= 0;
4721 pSA
= SafeArrayCreate (VT_VARIANT
, 1, dimensions
);
4726 LIBTEST_API
int STDCALL
4727 mono_test_marshal_safearray_out_1dim_vt_bstr (SAFEARRAY
** safearray
)
4729 /* Create a one-dimensional array of 10 variants filled with "0" to "9" */
4731 SAFEARRAYBOUND dimensions
[1];
4737 dimensions
[0].lLbound
= 0;
4738 dimensions
[0].cElements
= 10;
4740 pSA
= SafeArrayCreate (VT_VARIANT
, 1, dimensions
);
4741 for (i
= dimensions
[0].lLbound
; i
< (dimensions
[0].cElements
+ dimensions
[0].lLbound
); i
++) {
4743 VariantInit (&vOut
);
4745 _ltoa (i
,buffer
,10);
4746 vOut
.bstrVal
= marshal_bstr_alloc (buffer
);
4748 if ((hr
= SafeArrayPutElement (pSA
, indices
, &vOut
)) != S_OK
) {
4749 VariantClear (&vOut
);
4750 SafeArrayDestroy (pSA
);
4753 VariantClear (&vOut
);
4759 LIBTEST_API
int STDCALL
4760 mono_test_marshal_safearray_out_2dim_vt_i4 (SAFEARRAY
** safearray
)
4762 /* Create a two-dimensional array of 4x3 variants filled with 11, 12, 13, etc. */
4764 SAFEARRAYBOUND dimensions
[2];
4769 dimensions
[0].lLbound
= 0;
4770 dimensions
[0].cElements
= 4;
4771 dimensions
[1].lLbound
= 0;
4772 dimensions
[1].cElements
= 3;
4774 pSA
= SafeArrayCreate(VT_VARIANT
, 2, dimensions
);
4775 for (i
= dimensions
[0].lLbound
; i
< (dimensions
[0].cElements
+ dimensions
[0].lLbound
); i
++) {
4776 for (j
= dimensions
[1].lLbound
; j
< (dimensions
[1].cElements
+ dimensions
[1].lLbound
); j
++) {
4778 VariantInit (&vOut
);
4780 vOut
.lVal
= (i
+1)*10+(j
+1);
4783 if ((hr
= SafeArrayPutElement (pSA
, indices
, &vOut
)) != S_OK
) {
4784 VariantClear (&vOut
);
4785 SafeArrayDestroy (pSA
);
4788 VariantClear (&vOut
); // does a deep destroy of source VARIANT
4795 LIBTEST_API
int STDCALL
4796 mono_test_marshal_safearray_out_4dim_vt_i4 (SAFEARRAY
** safearray
)
4798 /* Create a four-dimensional array of 10x3x6x7 variants filled with their indices */
4799 /* Also use non zero lower bounds */
4801 SAFEARRAYBOUND dimensions
[4];
4806 dimensions
[0].lLbound
= 15;
4807 dimensions
[0].cElements
= 10;
4808 dimensions
[1].lLbound
= 20;
4809 dimensions
[1].cElements
= 3;
4810 dimensions
[2].lLbound
= 5;
4811 dimensions
[2].cElements
= 6;
4812 dimensions
[3].lLbound
= 12;
4813 dimensions
[3].cElements
= 7;
4815 pSA
= SafeArrayCreate (VT_VARIANT
, 4, dimensions
);
4817 SafeArrayAccessData (pSA
, (void **)&pData
);
4819 for (i
= 0; i
< 10*3*6*7; i
++) {
4820 VariantInit(&pData
[i
]);
4821 pData
[i
].vt
= VT_I4
;
4824 SafeArrayUnaccessData (pSA
);
4829 LIBTEST_API
int STDCALL
4830 mono_test_marshal_safearray_in_byval_1dim_empty (SAFEARRAY
* safearray
)
4832 /* Check that array is one dimensional and empty */
4835 long lbound
, ubound
;
4837 dim
= SafeArrayGetDim (safearray
);
4841 SafeArrayGetLBound (safearray
, 1, &lbound
);
4842 SafeArrayGetUBound (safearray
, 1, &ubound
);
4844 if ((lbound
> 0) || (ubound
> 0))
4850 LIBTEST_API
int STDCALL
4851 mono_test_marshal_safearray_in_byval_1dim_vt_i4 (SAFEARRAY
* safearray
)
4853 /* Check that array is one dimensional containing integers from 1 to 10 */
4856 long lbound
, ubound
;
4861 dim
= SafeArrayGetDim (safearray
);
4865 SafeArrayGetLBound (safearray
, 1, &lbound
);
4866 SafeArrayGetUBound (safearray
, 1, &ubound
);
4868 if ((lbound
!= 0) || (ubound
!= 9))
4871 SafeArrayAccessData (safearray
, (void **)&pData
);
4872 for (i
= lbound
; i
<= ubound
; i
++) {
4873 if ((VariantChangeType (&pData
[i
], &pData
[i
], VARIANT_NOUSEROVERRIDE
, VT_I4
) != S_OK
) || (pData
[i
].lVal
!= i
+ 1))
4876 SafeArrayUnaccessData (safearray
);
4881 LIBTEST_API
int STDCALL
4882 mono_test_marshal_safearray_in_byval_1dim_vt_mixed (SAFEARRAY
* safearray
)
4884 /* Check that array is one dimensional containing integers mixed with strings from 0 to 12 */
4887 long lbound
, ubound
;
4894 VariantInit (&element
);
4896 dim
= SafeArrayGetDim (safearray
);
4900 SafeArrayGetLBound (safearray
, 1, &lbound
);
4901 SafeArrayGetUBound (safearray
, 1, &ubound
);
4903 if ((lbound
!= 0) || (ubound
!= 12))
4906 SafeArrayAccessData (safearray
, (void **)&pData
);
4907 for (i
= lbound
; i
<= ubound
; i
++) {
4908 if ((i
%2 == 0) && (pData
[i
].vt
!= VT_I4
))
4910 if ((i
%2 == 1) && (pData
[i
].vt
!= VT_BSTR
))
4912 if ((VariantChangeType (&pData
[i
], &pData
[i
], VARIANT_NOUSEROVERRIDE
, VT_I4
) != S_OK
) || (pData
[i
].lVal
!= i
))
4915 SafeArrayUnaccessData (safearray
);
4917 /* Change the first element of the array to verify that [in] parameters are not marshalled back to the managed side */
4922 SafeArrayPutElement (safearray
, indices
, &element
);
4923 VariantClear (&element
);
4928 LIBTEST_API
int STDCALL
4929 mono_test_marshal_safearray_in_byval_2dim_vt_i4 (SAFEARRAY
* safearray
)
4931 /* Check that array is one dimensional containing integers mixed with strings from 0 to 12 */
4934 long lbound1
, ubound1
, lbound2
, ubound2
;
4939 VariantInit (&element
);
4941 dim
= SafeArrayGetDim (safearray
);
4945 SafeArrayGetLBound (safearray
, 1, &lbound1
);
4946 SafeArrayGetUBound (safearray
, 1, &ubound1
);
4948 if ((lbound1
!= 0) || (ubound1
!= 1))
4951 SafeArrayGetLBound (safearray
, 2, &lbound2
);
4952 SafeArrayGetUBound (safearray
, 2, &ubound2
);
4954 if ((lbound2
!= 0) || (ubound2
!= 3)) {
4958 for (i
= lbound1
; i
<= ubound1
; i
++) {
4960 for (j
= lbound2
; j
<= ubound2
; j
++) {
4962 if (SafeArrayGetElement (safearray
, indices
, &element
) != S_OK
)
4964 failed
= ((element
.vt
!= VT_I4
) || (element
.lVal
!= 10*(i
+1)+(j
+1)));
4965 VariantClear (&element
);
4971 /* Change the first element of the array to verify that [in] parameters are not marshalled back to the managed side */
4977 SafeArrayPutElement (safearray
, indices
, &element
);
4978 VariantClear (&element
);
4983 LIBTEST_API
int STDCALL
4984 mono_test_marshal_safearray_in_byval_3dim_vt_bstr (SAFEARRAY
* safearray
)
4986 /* Check that array is one dimensional containing integers mixed with strings from 0 to 12 */
4989 long lbound1
, ubound1
, lbound2
, ubound2
, lbound3
, ubound3
;
4990 long i
, j
, k
, failed
;
4994 VariantInit (&element
);
4996 dim
= SafeArrayGetDim (safearray
);
5000 SafeArrayGetLBound (safearray
, 1, &lbound1
);
5001 SafeArrayGetUBound (safearray
, 1, &ubound1
);
5003 if ((lbound1
!= 0) || (ubound1
!= 1))
5006 SafeArrayGetLBound (safearray
, 2, &lbound2
);
5007 SafeArrayGetUBound (safearray
, 2, &ubound2
);
5009 if ((lbound2
!= 0) || (ubound2
!= 1))
5012 SafeArrayGetLBound (safearray
, 3, &lbound3
);
5013 SafeArrayGetUBound (safearray
, 3, &ubound3
);
5015 if ((lbound3
!= 0) || (ubound3
!= 2))
5018 for (i
= lbound1
; i
<= ubound1
; i
++) {
5020 for (j
= lbound2
; j
<= ubound2
; j
++) {
5022 for (k
= lbound3
; k
<= ubound3
; k
++) {
5024 if (SafeArrayGetElement (safearray
, indices
, &element
) != S_OK
)
5026 failed
= ((element
.vt
!= VT_BSTR
)
5027 || (VariantChangeType (&element
, &element
, VARIANT_NOUSEROVERRIDE
, VT_I4
) != S_OK
)
5028 || (element
.lVal
!= 100*(i
+1)+10*(j
+1)+(k
+1)));
5029 VariantClear (&element
);
5036 /* Change the first element of the array to verify that [in] parameters are not marshalled back to the managed side */
5041 element
.vt
= VT_BSTR
;
5042 element
.bstrVal
= SysAllocString(L
"Should not be copied");
5043 SafeArrayPutElement (safearray
, indices
, &element
);
5044 VariantClear (&element
);
5049 LIBTEST_API
int STDCALL
5050 mono_test_marshal_safearray_in_byref_3dim_vt_bstr (SAFEARRAY
** safearray
)
5052 return mono_test_marshal_safearray_in_byval_3dim_vt_bstr (*safearray
);
5055 LIBTEST_API
int STDCALL
5056 mono_test_marshal_safearray_in_out_byref_1dim_empty (SAFEARRAY
** safearray
)
5058 /* Check that the input array is what is expected and change it so the caller can check */
5059 /* correct marshalling back to managed code */
5062 long lbound
, ubound
;
5063 SAFEARRAYBOUND dimensions
[1];
5065 wchar_t buffer
[20];
5069 /* Check that in array is one dimensional and empty */
5071 dim
= SafeArrayGetDim (*safearray
);
5076 SafeArrayGetLBound (*safearray
, 1, &lbound
);
5077 SafeArrayGetUBound (*safearray
, 1, &ubound
);
5079 if ((lbound
> 0) || (ubound
> 0)) {
5083 /* Re-dimension the array and return a one-dimensional array of 8 variants filled with "0" to "7" */
5085 dimensions
[0].lLbound
= 0;
5086 dimensions
[0].cElements
= 8;
5088 hr
= SafeArrayRedim (*safearray
, dimensions
);
5092 for (i
= dimensions
[0].lLbound
; i
< (dimensions
[0].lLbound
+ dimensions
[0].cElements
); i
++) {
5094 VariantInit (&vOut
);
5096 _ltow (i
,buffer
,10);
5097 vOut
.bstrVal
= SysAllocString (buffer
);
5099 if ((hr
= SafeArrayPutElement (*safearray
, indices
, &vOut
)) != S_OK
) {
5100 VariantClear (&vOut
);
5101 SafeArrayDestroy (*safearray
);
5104 VariantClear (&vOut
);
5109 LIBTEST_API
int STDCALL
5110 mono_test_marshal_safearray_in_out_byref_3dim_vt_bstr (SAFEARRAY
** safearray
)
5112 /* Check that the input array is what is expected and change it so the caller can check */
5113 /* correct marshalling back to managed code */
5116 long lbound1
, ubound1
, lbound2
, ubound2
, lbound3
, ubound3
;
5117 SAFEARRAYBOUND dimensions
[1];
5118 long i
, j
, k
, failed
;
5119 wchar_t buffer
[20];
5124 VariantInit (&element
);
5126 /* Check that in array is three dimensional and contains the expected values */
5128 dim
= SafeArrayGetDim (*safearray
);
5132 SafeArrayGetLBound (*safearray
, 1, &lbound1
);
5133 SafeArrayGetUBound (*safearray
, 1, &ubound1
);
5135 if ((lbound1
!= 0) || (ubound1
!= 1))
5138 SafeArrayGetLBound (*safearray
, 2, &lbound2
);
5139 SafeArrayGetUBound (*safearray
, 2, &ubound2
);
5141 if ((lbound2
!= 0) || (ubound2
!= 1))
5144 SafeArrayGetLBound (*safearray
, 3, &lbound3
);
5145 SafeArrayGetUBound (*safearray
, 3, &ubound3
);
5147 if ((lbound3
!= 0) || (ubound3
!= 2))
5150 for (i
= lbound1
; i
<= ubound1
; i
++) {
5152 for (j
= lbound2
; j
<= ubound2
; j
++) {
5154 for (k
= lbound3
; k
<= ubound3
; k
++) {
5156 if (SafeArrayGetElement (*safearray
, indices
, &element
) != S_OK
)
5158 failed
= ((element
.vt
!= VT_BSTR
)
5159 || (VariantChangeType (&element
, &element
, VARIANT_NOUSEROVERRIDE
, VT_I4
) != S_OK
)
5160 || (element
.lVal
!= 100*(i
+1)+10*(j
+1)+(k
+1)));
5161 VariantClear (&element
);
5168 hr
= SafeArrayDestroy (*safearray
);
5172 /* Return a new one-dimensional array of 8 variants filled with "0" to "7" */
5174 dimensions
[0].lLbound
= 0;
5175 dimensions
[0].cElements
= 8;
5177 *safearray
= SafeArrayCreate (VT_VARIANT
, 1, dimensions
);
5179 for (i
= dimensions
[0].lLbound
; i
< (dimensions
[0].lLbound
+ dimensions
[0].cElements
); i
++) {
5181 VariantInit (&vOut
);
5183 _ltow (i
,buffer
,10);
5184 vOut
.bstrVal
= SysAllocString (buffer
);
5186 if ((hr
= SafeArrayPutElement (*safearray
, indices
, &vOut
)) != S_OK
) {
5187 VariantClear (&vOut
);
5188 SafeArrayDestroy (*safearray
);
5191 VariantClear (&vOut
);
5196 LIBTEST_API
int STDCALL
5197 mono_test_marshal_safearray_in_out_byref_1dim_vt_i4 (SAFEARRAY
** safearray
)
5199 /* Check that the input array is what is expected and change it so the caller can check */
5200 /* correct marshalling back to managed code */
5203 long lbound1
, ubound1
;
5209 VariantInit (&element
);
5211 /* Check that in array is one dimensional and contains the expected value */
5213 dim
= SafeArrayGetDim (*safearray
);
5217 SafeArrayGetLBound (*safearray
, 1, &lbound1
);
5218 SafeArrayGetUBound (*safearray
, 1, &ubound1
);
5221 if ((lbound1
!= 0) || (ubound1
!= 1))
5225 for (i
= lbound1
; i
<= ubound1
; i
++) {
5227 if (SafeArrayGetElement (*safearray
, indices
, &element
) != S_OK
)
5229 failed
= (element
.vt
!= VT_I4
) || (element
.lVal
!= i
+1);
5230 VariantClear (&element
);
5235 /* Change one of the elements of the array to verify that [out] parameter is marshalled back to the managed side */
5240 SafeArrayPutElement (*safearray
, indices
, &element
);
5241 VariantClear (&element
);
5246 LIBTEST_API
int STDCALL
5247 mono_test_marshal_safearray_in_out_byval_1dim_vt_i4 (SAFEARRAY
* safearray
)
5249 /* Check that the input array is what is expected and change it so the caller can check */
5250 /* correct marshalling back to managed code */
5253 long lbound1
, ubound1
;
5254 SAFEARRAYBOUND dimensions
[1];
5260 VariantInit (&element
);
5262 /* Check that in array is one dimensional and contains the expected value */
5264 dim
= SafeArrayGetDim (safearray
);
5268 SafeArrayGetLBound (safearray
, 1, &lbound1
);
5269 SafeArrayGetUBound (safearray
, 1, &ubound1
);
5271 if ((lbound1
!= 0) || (ubound1
!= 0))
5274 for (i
= lbound1
; i
<= ubound1
; i
++) {
5276 if (SafeArrayGetElement (safearray
, indices
, &element
) != S_OK
)
5278 failed
= (element
.vt
!= VT_I4
) || (element
.lVal
!= i
+1);
5279 VariantClear (&element
);
5284 /* Change the array to verify how [out] parameter is marshalled back to the managed side */
5286 /* Redimension the array */
5287 dimensions
[0].lLbound
= lbound1
;
5288 dimensions
[0].cElements
= 2;
5289 hr
= SafeArrayRedim(safearray
, dimensions
);
5293 element
.lVal
= 12345;
5294 SafeArrayPutElement (safearray
, indices
, &element
);
5295 VariantClear (&element
);
5299 element
.lVal
= -12345;
5300 SafeArrayPutElement (safearray
, indices
, &element
);
5301 VariantClear (&element
);
5306 LIBTEST_API
int STDCALL
5307 mono_test_marshal_safearray_in_out_byval_3dim_vt_bstr (SAFEARRAY
* safearray
)
5309 /* Check that the input array is what is expected and change it so the caller can check */
5310 /* correct marshalling back to managed code */
5313 long lbound1
, ubound1
, lbound2
, ubound2
, lbound3
, ubound3
;
5314 long i
, j
, k
, failed
;
5319 VariantInit (&element
);
5321 /* Check that in array is three dimensional and contains the expected values */
5323 dim
= SafeArrayGetDim (safearray
);
5327 SafeArrayGetLBound (safearray
, 1, &lbound1
);
5328 SafeArrayGetUBound (safearray
, 1, &ubound1
);
5330 if ((lbound1
!= 0) || (ubound1
!= 1))
5333 SafeArrayGetLBound (safearray
, 2, &lbound2
);
5334 SafeArrayGetUBound (safearray
, 2, &ubound2
);
5336 if ((lbound2
!= 0) || (ubound2
!= 1))
5339 SafeArrayGetLBound (safearray
, 3, &lbound3
);
5340 SafeArrayGetUBound (safearray
, 3, &ubound3
);
5342 if ((lbound3
!= 0) || (ubound3
!= 2))
5345 for (i
= lbound1
; i
<= ubound1
; i
++) {
5347 for (j
= lbound2
; j
<= ubound2
; j
++) {
5349 for (k
= lbound3
; k
<= ubound3
; k
++) {
5351 if (SafeArrayGetElement (safearray
, indices
, &element
) != S_OK
)
5353 failed
= ((element
.vt
!= VT_BSTR
)
5354 || (VariantChangeType (&element
, &element
, VARIANT_NOUSEROVERRIDE
, VT_I4
) != S_OK
)
5355 || (element
.lVal
!= 100*(i
+1)+10*(j
+1)+(k
+1)));
5356 VariantClear (&element
);
5363 /* Change the elements of the array to verify that [out] parameter is marshalled back to the managed side */
5370 SafeArrayPutElement (safearray
, indices
, &element
);
5371 VariantClear (&element
);
5378 SafeArrayPutElement (safearray
, indices
, &element
);
5379 VariantClear (&element
);
5384 element
.vt
= VT_BSTR
;
5385 element
.bstrVal
= marshal_bstr_alloc("ABCDEFG");
5386 SafeArrayPutElement (safearray
, indices
, &element
);
5387 VariantClear (&element
);
5392 LIBTEST_API
int STDCALL
5393 mono_test_marshal_safearray_mixed(
5394 SAFEARRAY
*safearray1
,
5395 SAFEARRAY
**safearray2
,
5396 SAFEARRAY
*safearray3
,
5397 SAFEARRAY
**safearray4
5402 /* Initialize out parameters */
5405 /* array1: Check that in array is one dimensional and contains the expected value */
5406 hr
= mono_test_marshal_safearray_in_out_byval_1dim_vt_i4 (safearray1
);
5408 /* array2: Fill in with some values to check on the managed side */
5410 hr
= mono_test_marshal_safearray_out_1dim_vt_bstr (safearray2
);
5412 /* array3: Check that in array is one dimensional and contains the expected value */
5414 hr
= mono_test_marshal_safearray_in_byval_1dim_vt_mixed(safearray3
);
5416 /* array4: Check input values and fill in with some values to check on the managed side */
5418 hr
= mono_test_marshal_safearray_in_out_byref_3dim_vt_bstr(safearray4
);
5425 static int call_managed_res
;
5428 call_managed (gpointer arg
)
5430 SimpleDelegate del
= (SimpleDelegate
)arg
;
5432 call_managed_res
= del (42);
5435 LIBTEST_API
int STDCALL
5436 mono_test_marshal_thread_attach (SimpleDelegate del
)
5444 res
= pthread_create (&t
, NULL
, (gpointer (*)(gpointer
))call_managed
, del
);
5445 g_assert (res
== 0);
5446 pthread_join (t
, NULL
);
5448 return call_managed_res
;
5452 typedef int (STDCALL
*Callback
) (void);
5454 static Callback callback
;
5456 LIBTEST_API
void STDCALL
5457 mono_test_marshal_set_callback (Callback cb
)
5462 LIBTEST_API
int STDCALL
5463 mono_test_marshal_call_callback (void)
5468 LIBTEST_API
int STDCALL
5469 mono_test_marshal_lpstr (char *str
)
5471 return strcmp ("ABC", str
);
5474 LIBTEST_API
int STDCALL
5475 mono_test_marshal_lpwstr (gunichar2
*str
)
5480 s
= g_utf16_to_utf8 (str
, -1, NULL
, NULL
, NULL
);
5481 res
= strcmp ("ABC", s
);
5487 LIBTEST_API
char* STDCALL
5488 mono_test_marshal_return_lpstr (void)
5490 char *res
= (char *)marshal_alloc (4);
5491 strcpy (res
, "XYZ");
5496 LIBTEST_API gunichar2
* STDCALL
5497 mono_test_marshal_return_lpwstr (void)
5499 gunichar2
*res
= (gunichar2
*)marshal_alloc (8);
5500 gunichar2
* tmp
= g_utf8_to_utf16 ("XYZ", -1, NULL
, NULL
, NULL
);
5502 memcpy (res
, tmp
, 8);
5510 } SingleDoubleStruct
;
5512 LIBTEST_API SingleDoubleStruct STDCALL
5513 mono_test_marshal_return_single_double_struct (void)
5515 SingleDoubleStruct res
;
5525 LIBTEST_API
int STDCALL
5526 mono_test_has_thiscall (void)
5532 _mono_test_native_thiscall1 (int arg
)
5538 _mono_test_native_thiscall2 (int arg
, int arg2
)
5540 return arg
+ (arg2
^1);
5544 _mono_test_native_thiscall3 (int arg
, int arg2
, int arg3
)
5546 return arg
+ (arg2
^1) + (arg3
^2);
5549 #elif defined(__GNUC__)
5551 LIBTEST_API
int STDCALL
5552 mono_test_has_thiscall (void)
5557 #define def_asm_fn(name) \
5559 "\t.globl _" #name "\n" \
5561 "\t.globl __" #name "\n" \
5566 def_asm_fn(mono_test_native_thiscall1
)
5567 "\tmovl %ecx,%eax\n"
5570 def_asm_fn(mono_test_native_thiscall2
)
5571 "\tmovl %ecx,%eax\n"
5572 "\tmovl 4(%esp),%ecx\n"
5574 "\taddl %ecx,%eax\n"
5577 def_asm_fn(mono_test_native_thiscall3
)
5578 "\tmovl %ecx,%eax\n"
5579 "\tmovl 4(%esp),%ecx\n"
5581 "\taddl %ecx,%eax\n"
5582 "\tmovl 8(%esp),%ecx\n"
5584 "\taddl %ecx,%eax\n"
5591 LIBTEST_API
int STDCALL
5592 mono_test_has_thiscall (void)
5604 LIBTEST_API sbyte1 STDCALL
5605 mono_return_sbyte1 (sbyte1 s1
, int addend
) {
5607 fprintf(stderr
, "mono_return_sbyte1 s1.f1: got %d but expected %d\n", s1
.f1
, 1);
5617 LIBTEST_API sbyte2 STDCALL
5618 mono_return_sbyte2 (sbyte2 s2
, int addend
) {
5620 fprintf(stderr
, "mono_return_sbyte2 s2.f1: got %d but expected %d\n", s2
.f1
, 1);
5623 fprintf(stderr
, "mono_return_sbyte2 s2.f2: got %d but expected %d\n", s2
.f2
, 2);
5625 s2
.f1
+=addend
; s2
.f2
+=addend
;
5633 LIBTEST_API sbyte3 STDCALL
5634 mono_return_sbyte3 (sbyte3 s3
, int addend
) {
5636 fprintf(stderr
, "mono_return_sbyte3 s3.f1: got %d but expected %d\n", s3
.f1
, 1);
5639 fprintf(stderr
, "mono_return_sbyte3 s3.f2: got %d but expected %d\n", s3
.f2
, 2);
5642 fprintf(stderr
, "mono_return_sbyte3 s3.f3: got %d but expected %d\n", s3
.f3
, 3);
5644 s3
.f1
+=addend
; s3
.f2
+=addend
; s3
.f3
+=addend
;
5652 LIBTEST_API sbyte4 STDCALL
5653 mono_return_sbyte4 (sbyte4 s4
, int addend
) {
5655 fprintf(stderr
, "mono_return_sbyte4 s4.f1: got %d but expected %d\n", s4
.f1
, 1);
5658 fprintf(stderr
, "mono_return_sbyte4 s4.f2: got %d but expected %d\n", s4
.f2
, 2);
5661 fprintf(stderr
, "mono_return_sbyte4 s4.f3: got %d but expected %d\n", s4
.f3
, 3);
5664 fprintf(stderr
, "mono_return_sbyte4 s4.f4: got %d but expected %d\n", s4
.f4
, 4);
5666 s4
.f1
+=addend
; s4
.f2
+=addend
; s4
.f3
+=addend
; s4
.f4
+=addend
;
5671 char f1
,f2
,f3
,f4
,f5
;
5674 LIBTEST_API sbyte5 STDCALL
5675 mono_return_sbyte5 (sbyte5 s5
, int addend
) {
5677 fprintf(stderr
, "mono_return_sbyte5 s5.f1: got %d but expected %d\n", s5
.f1
, 1);
5680 fprintf(stderr
, "mono_return_sbyte5 s5.f2: got %d but expected %d\n", s5
.f2
, 2);
5683 fprintf(stderr
, "mono_return_sbyte5 s5.f3: got %d but expected %d\n", s5
.f3
, 3);
5686 fprintf(stderr
, "mono_return_sbyte5 s5.f4: got %d but expected %d\n", s5
.f4
, 4);
5689 fprintf(stderr
, "mono_return_sbyte5 s5.f5: got %d but expected %d\n", s5
.f5
, 5);
5691 s5
.f1
+=addend
; s5
.f2
+=addend
; s5
.f3
+=addend
; s5
.f4
+=addend
; s5
.f5
+=addend
;
5696 char f1
,f2
,f3
,f4
,f5
,f6
;
5699 LIBTEST_API sbyte6 STDCALL
5700 mono_return_sbyte6 (sbyte6 s6
, int addend
) {
5702 fprintf(stderr
, "mono_return_sbyte6 s6.f1: got %d but expected %d\n", s6
.f1
, 1);
5705 fprintf(stderr
, "mono_return_sbyte6 s6.f2: got %d but expected %d\n", s6
.f2
, 2);
5708 fprintf(stderr
, "mono_return_sbyte6 s6.f3: got %d but expected %d\n", s6
.f3
, 3);
5711 fprintf(stderr
, "mono_return_sbyte6 s6.f4: got %d but expected %d\n", s6
.f4
, 4);
5714 fprintf(stderr
, "mono_return_sbyte6 s6.f5: got %d but expected %d\n", s6
.f5
, 5);
5717 fprintf(stderr
, "mono_return_sbyte6 s6.f6: got %d but expected %d\n", s6
.f6
, 6);
5719 s6
.f1
+=addend
; s6
.f2
+=addend
; s6
.f3
+=addend
; s6
.f4
+=addend
; s6
.f5
+=addend
; s6
.f6
+=addend
;
5724 char f1
,f2
,f3
,f4
,f5
,f6
,f7
;
5727 LIBTEST_API sbyte7 STDCALL
5728 mono_return_sbyte7 (sbyte7 s7
, int addend
) {
5730 fprintf(stderr
, "mono_return_sbyte7 s7.f1: got %d but expected %d\n", s7
.f1
, 1);
5733 fprintf(stderr
, "mono_return_sbyte7 s7.f2: got %d but expected %d\n", s7
.f2
, 2);
5736 fprintf(stderr
, "mono_return_sbyte7 s7.f3: got %d but expected %d\n", s7
.f3
, 3);
5739 fprintf(stderr
, "mono_return_sbyte7 s7.f4: got %d but expected %d\n", s7
.f4
, 4);
5742 fprintf(stderr
, "mono_return_sbyte7 s7.f5: got %d but expected %d\n", s7
.f5
, 5);
5745 fprintf(stderr
, "mono_return_sbyte7 s7.f6: got %d but expected %d\n", s7
.f6
, 6);
5748 fprintf(stderr
, "mono_return_sbyte7 s7.f7: got %d but expected %d\n", s7
.f7
, 7);
5750 s7
.f1
+=addend
; s7
.f2
+=addend
; s7
.f3
+=addend
; s7
.f4
+=addend
; s7
.f5
+=addend
; s7
.f6
+=addend
; s7
.f7
+=addend
;
5755 char f1
,f2
,f3
,f4
,f5
,f6
,f7
,f8
;
5758 LIBTEST_API sbyte8 STDCALL
5759 mono_return_sbyte8 (sbyte8 s8
, int addend
) {
5761 fprintf(stderr
, "mono_return_sbyte8 s8.f1: got %d but expected %d\n", s8
.f1
, 1);
5764 fprintf(stderr
, "mono_return_sbyte8 s8.f2: got %d but expected %d\n", s8
.f2
, 2);
5767 fprintf(stderr
, "mono_return_sbyte8 s8.f3: got %d but expected %d\n", s8
.f3
, 3);
5770 fprintf(stderr
, "mono_return_sbyte8 s8.f4: got %d but expected %d\n", s8
.f4
, 4);
5773 fprintf(stderr
, "mono_return_sbyte8 s8.f5: got %d but expected %d\n", s8
.f5
, 5);
5776 fprintf(stderr
, "mono_return_sbyte8 s8.f6: got %d but expected %d\n", s8
.f6
, 6);
5779 fprintf(stderr
, "mono_return_sbyte8 s8.f7: got %d but expected %d\n", s8
.f7
, 7);
5782 fprintf(stderr
, "mono_return_sbyte8 s8.f8: got %d but expected %d\n", s8
.f8
, 8);
5784 s8
.f1
+=addend
; s8
.f2
+=addend
; s8
.f3
+=addend
; s8
.f4
+=addend
; s8
.f5
+=addend
; s8
.f6
+=addend
; s8
.f7
+=addend
; s8
.f8
+=addend
;
5789 char f1
,f2
,f3
,f4
,f5
,f6
,f7
,f8
,f9
;
5792 LIBTEST_API sbyte9 STDCALL
5793 mono_return_sbyte9 (sbyte9 s9
, int addend
) {
5795 fprintf(stderr
, "mono_return_sbyte9 s9.f1: got %d but expected %d\n", s9
.f1
, 1);
5798 fprintf(stderr
, "mono_return_sbyte9 s9.f2: got %d but expected %d\n", s9
.f2
, 2);
5801 fprintf(stderr
, "mono_return_sbyte9 s9.f3: got %d but expected %d\n", s9
.f3
, 3);
5804 fprintf(stderr
, "mono_return_sbyte9 s9.f4: got %d but expected %d\n", s9
.f4
, 4);
5807 fprintf(stderr
, "mono_return_sbyte9 s9.f5: got %d but expected %d\n", s9
.f5
, 5);
5810 fprintf(stderr
, "mono_return_sbyte9 s9.f6: got %d but expected %d\n", s9
.f6
, 6);
5813 fprintf(stderr
, "mono_return_sbyte9 s9.f7: got %d but expected %d\n", s9
.f7
, 7);
5816 fprintf(stderr
, "mono_return_sbyte9 s9.f8: got %d but expected %d\n", s9
.f8
, 8);
5819 fprintf(stderr
, "mono_return_sbyte9 s9.f9: got %d but expected %d\n", s9
.f9
, 9);
5821 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
;
5826 char f1
,f2
,f3
,f4
,f5
,f6
,f7
,f8
,f9
,f10
;
5829 LIBTEST_API sbyte10 STDCALL
5830 mono_return_sbyte10 (sbyte10 s10
, int addend
) {
5832 fprintf(stderr
, "mono_return_sbyte10 s10.f1: got %d but expected %d\n", s10
.f1
, 1);
5835 fprintf(stderr
, "mono_return_sbyte10 s10.f2: got %d but expected %d\n", s10
.f2
, 2);
5838 fprintf(stderr
, "mono_return_sbyte10 s10.f3: got %d but expected %d\n", s10
.f3
, 3);
5841 fprintf(stderr
, "mono_return_sbyte10 s10.f4: got %d but expected %d\n", s10
.f4
, 4);
5844 fprintf(stderr
, "mono_return_sbyte10 s10.f5: got %d but expected %d\n", s10
.f5
, 5);
5847 fprintf(stderr
, "mono_return_sbyte10 s10.f6: got %d but expected %d\n", s10
.f6
, 6);
5850 fprintf(stderr
, "mono_return_sbyte10 s10.f7: got %d but expected %d\n", s10
.f7
, 7);
5853 fprintf(stderr
, "mono_return_sbyte10 s10.f8: got %d but expected %d\n", s10
.f8
, 8);
5856 fprintf(stderr
, "mono_return_sbyte10 s10.f9: got %d but expected %d\n", s10
.f9
, 9);
5858 if (s10
.f10
!= 10) {
5859 fprintf(stderr
, "mono_return_sbyte10 s10.f10: got %d but expected %d\n", s10
.f10
, 10);
5861 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
;
5866 char f1
,f2
,f3
,f4
,f5
,f6
,f7
,f8
,f9
,f10
,f11
;
5869 LIBTEST_API sbyte11 STDCALL
5870 mono_return_sbyte11 (sbyte11 s11
, int addend
) {
5872 fprintf(stderr
, "mono_return_sbyte11 s11.f1: got %d but expected %d\n", s11
.f1
, 1);
5875 fprintf(stderr
, "mono_return_sbyte11 s11.f2: got %d but expected %d\n", s11
.f2
, 2);
5878 fprintf(stderr
, "mono_return_sbyte11 s11.f3: got %d but expected %d\n", s11
.f3
, 3);
5881 fprintf(stderr
, "mono_return_sbyte11 s11.f4: got %d but expected %d\n", s11
.f4
, 4);
5884 fprintf(stderr
, "mono_return_sbyte11 s11.f5: got %d but expected %d\n", s11
.f5
, 5);
5887 fprintf(stderr
, "mono_return_sbyte11 s11.f6: got %d but expected %d\n", s11
.f6
, 6);
5890 fprintf(stderr
, "mono_return_sbyte11 s11.f7: got %d but expected %d\n", s11
.f7
, 7);
5893 fprintf(stderr
, "mono_return_sbyte11 s11.f8: got %d but expected %d\n", s11
.f8
, 8);
5896 fprintf(stderr
, "mono_return_sbyte11 s11.f9: got %d but expected %d\n", s11
.f9
, 9);
5898 if (s11
.f10
!= 10) {
5899 fprintf(stderr
, "mono_return_sbyte11 s11.f10: got %d but expected %d\n", s11
.f10
, 10);
5901 if (s11
.f11
!= 11) {
5902 fprintf(stderr
, "mono_return_sbyte11 s11.f11: got %d but expected %d\n", s11
.f11
, 11);
5904 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
;
5909 char f1
,f2
,f3
,f4
,f5
,f6
,f7
,f8
,f9
,f10
,f11
,f12
;
5912 LIBTEST_API sbyte12 STDCALL
5913 mono_return_sbyte12 (sbyte12 s12
, int addend
) {
5915 fprintf(stderr
, "mono_return_sbyte12 s12.f1: got %d but expected %d\n", s12
.f1
, 1);
5918 fprintf(stderr
, "mono_return_sbyte12 s12.f2: got %d but expected %d\n", s12
.f2
, 2);
5921 fprintf(stderr
, "mono_return_sbyte12 s12.f3: got %d but expected %d\n", s12
.f3
, 3);
5924 fprintf(stderr
, "mono_return_sbyte12 s12.f4: got %d but expected %d\n", s12
.f4
, 4);
5927 fprintf(stderr
, "mono_return_sbyte12 s12.f5: got %d but expected %d\n", s12
.f5
, 5);
5930 fprintf(stderr
, "mono_return_sbyte12 s12.f6: got %d but expected %d\n", s12
.f6
, 6);
5933 fprintf(stderr
, "mono_return_sbyte12 s12.f7: got %d but expected %d\n", s12
.f7
, 7);
5936 fprintf(stderr
, "mono_return_sbyte12 s12.f8: got %d but expected %d\n", s12
.f8
, 8);
5939 fprintf(stderr
, "mono_return_sbyte12 s12.f9: got %d but expected %d\n", s12
.f9
, 9);
5941 if (s12
.f10
!= 10) {
5942 fprintf(stderr
, "mono_return_sbyte12 s12.f10: got %d but expected %d\n", s12
.f10
, 10);
5944 if (s12
.f11
!= 11) {
5945 fprintf(stderr
, "mono_return_sbyte12 s12.f11: got %d but expected %d\n", s12
.f11
, 11);
5947 if (s12
.f12
!= 12) {
5948 fprintf(stderr
, "mono_return_sbyte12 s12.f12: got %d but expected %d\n", s12
.f12
, 12);
5950 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
;
5955 char f1
,f2
,f3
,f4
,f5
,f6
,f7
,f8
,f9
,f10
,f11
,f12
,f13
;
5958 LIBTEST_API sbyte13 STDCALL
5959 mono_return_sbyte13 (sbyte13 s13
, int addend
) {
5961 fprintf(stderr
, "mono_return_sbyte13 s13.f1: got %d but expected %d\n", s13
.f1
, 1);
5964 fprintf(stderr
, "mono_return_sbyte13 s13.f2: got %d but expected %d\n", s13
.f2
, 2);
5967 fprintf(stderr
, "mono_return_sbyte13 s13.f3: got %d but expected %d\n", s13
.f3
, 3);
5970 fprintf(stderr
, "mono_return_sbyte13 s13.f4: got %d but expected %d\n", s13
.f4
, 4);
5973 fprintf(stderr
, "mono_return_sbyte13 s13.f5: got %d but expected %d\n", s13
.f5
, 5);
5976 fprintf(stderr
, "mono_return_sbyte13 s13.f6: got %d but expected %d\n", s13
.f6
, 6);
5979 fprintf(stderr
, "mono_return_sbyte13 s13.f7: got %d but expected %d\n", s13
.f7
, 7);
5982 fprintf(stderr
, "mono_return_sbyte13 s13.f8: got %d but expected %d\n", s13
.f8
, 8);
5985 fprintf(stderr
, "mono_return_sbyte13 s13.f9: got %d but expected %d\n", s13
.f9
, 9);
5987 if (s13
.f10
!= 10) {
5988 fprintf(stderr
, "mono_return_sbyte13 s13.f10: got %d but expected %d\n", s13
.f10
, 10);
5990 if (s13
.f11
!= 11) {
5991 fprintf(stderr
, "mono_return_sbyte13 s13.f11: got %d but expected %d\n", s13
.f11
, 11);
5993 if (s13
.f12
!= 12) {
5994 fprintf(stderr
, "mono_return_sbyte13 s13.f12: got %d but expected %d\n", s13
.f12
, 12);
5996 if (s13
.f13
!= 13) {
5997 fprintf(stderr
, "mono_return_sbyte13 s13.f13: got %d but expected %d\n", s13
.f13
, 13);
5999 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
;
6004 char f1
,f2
,f3
,f4
,f5
,f6
,f7
,f8
,f9
,f10
,f11
,f12
,f13
,f14
;
6007 LIBTEST_API sbyte14 STDCALL
6008 mono_return_sbyte14 (sbyte14 s14
, int addend
) {
6010 fprintf(stderr
, "mono_return_sbyte14 s14.f1: got %d but expected %d\n", s14
.f1
, 1);
6013 fprintf(stderr
, "mono_return_sbyte14 s14.f2: got %d but expected %d\n", s14
.f2
, 2);
6016 fprintf(stderr
, "mono_return_sbyte14 s14.f3: got %d but expected %d\n", s14
.f3
, 3);
6019 fprintf(stderr
, "mono_return_sbyte14 s14.f4: got %d but expected %d\n", s14
.f4
, 4);
6022 fprintf(stderr
, "mono_return_sbyte14 s14.f5: got %d but expected %d\n", s14
.f5
, 5);
6025 fprintf(stderr
, "mono_return_sbyte14 s14.f6: got %d but expected %d\n", s14
.f6
, 6);
6028 fprintf(stderr
, "mono_return_sbyte14 s14.f7: got %d but expected %d\n", s14
.f7
, 7);
6031 fprintf(stderr
, "mono_return_sbyte14 s14.f8: got %d but expected %d\n", s14
.f8
, 8);
6034 fprintf(stderr
, "mono_return_sbyte14 s14.f9: got %d but expected %d\n", s14
.f9
, 9);
6036 if (s14
.f10
!= 10) {
6037 fprintf(stderr
, "mono_return_sbyte14 s14.f10: got %d but expected %d\n", s14
.f10
, 10);
6039 if (s14
.f11
!= 11) {
6040 fprintf(stderr
, "mono_return_sbyte14 s14.f11: got %d but expected %d\n", s14
.f11
, 11);
6042 if (s14
.f12
!= 12) {
6043 fprintf(stderr
, "mono_return_sbyte14 s14.f12: got %d but expected %d\n", s14
.f12
, 12);
6045 if (s14
.f13
!= 13) {
6046 fprintf(stderr
, "mono_return_sbyte14 s14.f13: got %d but expected %d\n", s14
.f13
, 13);
6048 if (s14
.f14
!= 14) {
6049 fprintf(stderr
, "mono_return_sbyte14 s14.f14: got %d but expected %d\n", s14
.f14
, 14);
6051 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
;
6056 char f1
,f2
,f3
,f4
,f5
,f6
,f7
,f8
,f9
,f10
,f11
,f12
,f13
,f14
,f15
;
6059 LIBTEST_API sbyte15 STDCALL
6060 mono_return_sbyte15 (sbyte15 s15
, int addend
) {
6062 fprintf(stderr
, "mono_return_sbyte15 s15.f1: got %d but expected %d\n", s15
.f1
, 1);
6065 fprintf(stderr
, "mono_return_sbyte15 s15.f2: got %d but expected %d\n", s15
.f2
, 2);
6068 fprintf(stderr
, "mono_return_sbyte15 s15.f3: got %d but expected %d\n", s15
.f3
, 3);
6071 fprintf(stderr
, "mono_return_sbyte15 s15.f4: got %d but expected %d\n", s15
.f4
, 4);
6074 fprintf(stderr
, "mono_return_sbyte15 s15.f5: got %d but expected %d\n", s15
.f5
, 5);
6077 fprintf(stderr
, "mono_return_sbyte15 s15.f6: got %d but expected %d\n", s15
.f6
, 6);
6080 fprintf(stderr
, "mono_return_sbyte15 s15.f7: got %d but expected %d\n", s15
.f7
, 7);
6083 fprintf(stderr
, "mono_return_sbyte15 s15.f8: got %d but expected %d\n", s15
.f8
, 8);
6086 fprintf(stderr
, "mono_return_sbyte15 s15.f9: got %d but expected %d\n", s15
.f9
, 9);
6088 if (s15
.f10
!= 10) {
6089 fprintf(stderr
, "mono_return_sbyte15 s15.f10: got %d but expected %d\n", s15
.f10
, 10);
6091 if (s15
.f11
!= 11) {
6092 fprintf(stderr
, "mono_return_sbyte15 s15.f11: got %d but expected %d\n", s15
.f11
, 11);
6094 if (s15
.f12
!= 12) {
6095 fprintf(stderr
, "mono_return_sbyte15 s15.f12: got %d but expected %d\n", s15
.f12
, 12);
6097 if (s15
.f13
!= 13) {
6098 fprintf(stderr
, "mono_return_sbyte15 s15.f13: got %d but expected %d\n", s15
.f13
, 13);
6100 if (s15
.f14
!= 14) {
6101 fprintf(stderr
, "mono_return_sbyte15 s15.f14: got %d but expected %d\n", s15
.f14
, 14);
6103 if (s15
.f15
!= 15) {
6104 fprintf(stderr
, "mono_return_sbyte15 s15.f15: got %d but expected %d\n", s15
.f15
, 15);
6106 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
;
6111 char f1
,f2
,f3
,f4
,f5
,f6
,f7
,f8
,f9
,f10
,f11
,f12
,f13
,f14
,f15
,f16
;
6114 LIBTEST_API sbyte16 STDCALL
6115 mono_return_sbyte16 (sbyte16 s16
, int addend
) {
6117 fprintf(stderr
, "mono_return_sbyte16 s16.f1: got %d but expected %d\n", s16
.f1
, 1);
6120 fprintf(stderr
, "mono_return_sbyte16 s16.f2: got %d but expected %d\n", s16
.f2
, 2);
6123 fprintf(stderr
, "mono_return_sbyte16 s16.f3: got %d but expected %d\n", s16
.f3
, 3);
6126 fprintf(stderr
, "mono_return_sbyte16 s16.f4: got %d but expected %d\n", s16
.f4
, 4);
6129 fprintf(stderr
, "mono_return_sbyte16 s16.f5: got %d but expected %d\n", s16
.f5
, 5);
6132 fprintf(stderr
, "mono_return_sbyte16 s16.f6: got %d but expected %d\n", s16
.f6
, 6);
6135 fprintf(stderr
, "mono_return_sbyte16 s16.f7: got %d but expected %d\n", s16
.f7
, 7);
6138 fprintf(stderr
, "mono_return_sbyte16 s16.f8: got %d but expected %d\n", s16
.f8
, 8);
6141 fprintf(stderr
, "mono_return_sbyte16 s16.f9: got %d but expected %d\n", s16
.f9
, 9);
6143 if (s16
.f10
!= 10) {
6144 fprintf(stderr
, "mono_return_sbyte16 s16.f10: got %d but expected %d\n", s16
.f10
, 10);
6146 if (s16
.f11
!= 11) {
6147 fprintf(stderr
, "mono_return_sbyte16 s16.f11: got %d but expected %d\n", s16
.f11
, 11);
6149 if (s16
.f12
!= 12) {
6150 fprintf(stderr
, "mono_return_sbyte16 s16.f12: got %d but expected %d\n", s16
.f12
, 12);
6152 if (s16
.f13
!= 13) {
6153 fprintf(stderr
, "mono_return_sbyte16 s16.f13: got %d but expected %d\n", s16
.f13
, 13);
6155 if (s16
.f14
!= 14) {
6156 fprintf(stderr
, "mono_return_sbyte16 s16.f14: got %d but expected %d\n", s16
.f14
, 14);
6158 if (s16
.f15
!= 15) {
6159 fprintf(stderr
, "mono_return_sbyte16 s16.f15: got %d but expected %d\n", s16
.f15
, 15);
6161 if (s16
.f16
!= 16) {
6162 fprintf(stderr
, "mono_return_sbyte16 s16.f16: got %d but expected %d\n", s16
.f16
, 16);
6164 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
;
6169 char f1
,f2
,f3
,f4
,f5
,f6
,f7
,f8
,f9
,f10
,f11
,f12
,f13
,f14
,f15
,f16
,f17
;
6172 LIBTEST_API sbyte17 STDCALL
6173 mono_return_sbyte17 (sbyte17 s17
, int addend
) {
6175 fprintf(stderr
, "mono_return_sbyte17 s17.f1: got %d but expected %d\n", s17
.f1
, 1);
6178 fprintf(stderr
, "mono_return_sbyte17 s17.f2: got %d but expected %d\n", s17
.f2
, 2);
6181 fprintf(stderr
, "mono_return_sbyte17 s17.f3: got %d but expected %d\n", s17
.f3
, 3);
6184 fprintf(stderr
, "mono_return_sbyte17 s17.f4: got %d but expected %d\n", s17
.f4
, 4);
6187 fprintf(stderr
, "mono_return_sbyte17 s17.f5: got %d but expected %d\n", s17
.f5
, 5);
6190 fprintf(stderr
, "mono_return_sbyte17 s17.f6: got %d but expected %d\n", s17
.f6
, 6);
6193 fprintf(stderr
, "mono_return_sbyte17 s17.f7: got %d but expected %d\n", s17
.f7
, 7);
6196 fprintf(stderr
, "mono_return_sbyte17 s17.f8: got %d but expected %d\n", s17
.f8
, 8);
6199 fprintf(stderr
, "mono_return_sbyte17 s17.f9: got %d but expected %d\n", s17
.f9
, 9);
6201 if (s17
.f10
!= 10) {
6202 fprintf(stderr
, "mono_return_sbyte17 s17.f10: got %d but expected %d\n", s17
.f10
, 10);
6204 if (s17
.f11
!= 11) {
6205 fprintf(stderr
, "mono_return_sbyte17 s17.f11: got %d but expected %d\n", s17
.f11
, 11);
6207 if (s17
.f12
!= 12) {
6208 fprintf(stderr
, "mono_return_sbyte17 s17.f12: got %d but expected %d\n", s17
.f12
, 12);
6210 if (s17
.f13
!= 13) {
6211 fprintf(stderr
, "mono_return_sbyte17 s17.f13: got %d but expected %d\n", s17
.f13
, 13);
6213 if (s17
.f14
!= 14) {
6214 fprintf(stderr
, "mono_return_sbyte17 s17.f14: got %d but expected %d\n", s17
.f14
, 14);
6216 if (s17
.f15
!= 15) {
6217 fprintf(stderr
, "mono_return_sbyte17 s17.f15: got %d but expected %d\n", s17
.f15
, 15);
6219 if (s17
.f16
!= 16) {
6220 fprintf(stderr
, "mono_return_sbyte17 s17.f16: got %d but expected %d\n", s17
.f16
, 16);
6222 if (s17
.f17
!= 17) {
6223 fprintf(stderr
, "mono_return_sbyte17 s17.f17: got %d but expected %d\n", s17
.f17
, 17);
6225 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
;
6233 char f2
,f3
,f4
,f5
,f6
,f7
,f8
,f9
,f10
,f11
,f12
,f13
,f14
,f15
;
6239 LIBTEST_API sbyte16_nested STDCALL
6240 mono_return_sbyte16_nested (sbyte16_nested sn16
, int addend
) {
6241 if (sn16
.nested1
.f1
!= 1) {
6242 fprintf(stderr
, "mono_return_sbyte16_nested sn16.nested1.f1: got %d but expected %d\n", sn16
.nested1
.f1
, 1);
6245 fprintf(stderr
, "mono_return_sbyte16_nested sn16.f2: got %d but expected %d\n", sn16
.f2
, 2);
6248 fprintf(stderr
, "mono_return_sbyte16_nested sn16.f3: got %d but expected %d\n", sn16
.f3
, 3);
6251 fprintf(stderr
, "mono_return_sbyte16_nested sn16.f4: got %d but expected %d\n", sn16
.f4
, 4);
6254 fprintf(stderr
, "mono_return_sbyte16_nested sn16.f5: got %d but expected %d\n", sn16
.f5
, 5);
6257 fprintf(stderr
, "mono_return_sbyte16_nested sn16.f6: got %d but expected %d\n", sn16
.f6
, 6);
6260 fprintf(stderr
, "mono_return_sbyte16_nested sn16.f7: got %d but expected %d\n", sn16
.f7
, 7);
6263 fprintf(stderr
, "mono_return_sbyte16_nested sn16.f8: got %d but expected %d\n", sn16
.f8
, 8);
6266 fprintf(stderr
, "mono_return_sbyte16_nested sn16.f9: got %d but expected %d\n", sn16
.f9
, 9);
6268 if (sn16
.f10
!= 10) {
6269 fprintf(stderr
, "mono_return_sbyte16_nested sn16.f10: got %d but expected %d\n", sn16
.f10
, 10);
6271 if (sn16
.f11
!= 11) {
6272 fprintf(stderr
, "mono_return_sbyte16_nested sn16.f11: got %d but expected %d\n", sn16
.f11
, 11);
6274 if (sn16
.f12
!= 12) {
6275 fprintf(stderr
, "mono_return_sbyte16_nested sn16.f12: got %d but expected %d\n", sn16
.f12
, 12);
6277 if (sn16
.f13
!= 13) {
6278 fprintf(stderr
, "mono_return_sbyte16_nested sn16.f13: got %d but expected %d\n", sn16
.f13
, 13);
6280 if (sn16
.f14
!= 14) {
6281 fprintf(stderr
, "mono_return_sbyte16_nested sn16.f14: got %d but expected %d\n", sn16
.f14
, 14);
6283 if (sn16
.f15
!= 15) {
6284 fprintf(stderr
, "mono_return_sbyte16_nested sn16.f15: got %d but expected %d\n", sn16
.f15
, 15);
6286 if (sn16
.nested2
.f16
!= 16) {
6287 fprintf(stderr
, "mono_return_sbyte16_nested sn16.nested2.f16: got %d but expected %d\n", sn16
.nested2
.f16
, 16);
6289 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
;
6298 LIBTEST_API short1 STDCALL
6299 mono_return_short1 (short1 s1
, int addend
) {
6301 fprintf(stderr
, "mono_return_short1 s1.f1: got %d but expected %d\n", s1
.f1
, 1);
6311 LIBTEST_API short2 STDCALL
6312 mono_return_short2 (short2 s2
, int addend
) {
6314 fprintf(stderr
, "mono_return_short2 s2.f1: got %d but expected %d\n", s2
.f1
, 1);
6317 fprintf(stderr
, "mono_return_short2 s2.f2: got %d but expected %d\n", s2
.f2
, 2);
6319 s2
.f1
+=addend
; s2
.f2
+=addend
;
6327 LIBTEST_API short3 STDCALL
6328 mono_return_short3 (short3 s3
, int addend
) {
6330 fprintf(stderr
, "mono_return_short3 s3.f1: got %d but expected %d\n", s3
.f1
, 1);
6333 fprintf(stderr
, "mono_return_short3 s3.f2: got %d but expected %d\n", s3
.f2
, 2);
6336 fprintf(stderr
, "mono_return_short3 s3.f3: got %d but expected %d\n", s3
.f3
, 3);
6338 s3
.f1
+=addend
; s3
.f2
+=addend
; s3
.f3
+=addend
;
6346 LIBTEST_API short4 STDCALL
6347 mono_return_short4 (short4 s4
, int addend
) {
6349 fprintf(stderr
, "mono_return_short4 s4.f1: got %d but expected %d\n", s4
.f1
, 1);
6352 fprintf(stderr
, "mono_return_short4 s4.f2: got %d but expected %d\n", s4
.f2
, 2);
6355 fprintf(stderr
, "mono_return_short4 s4.f3: got %d but expected %d\n", s4
.f3
, 3);
6358 fprintf(stderr
, "mono_return_short4 s4.f4: got %d but expected %d\n", s4
.f4
, 4);
6360 s4
.f1
+=addend
; s4
.f2
+=addend
; s4
.f3
+=addend
; s4
.f4
+=addend
;
6365 short f1
,f2
,f3
,f4
,f5
;
6368 LIBTEST_API short5 STDCALL
6369 mono_return_short5 (short5 s5
, int addend
) {
6371 fprintf(stderr
, "mono_return_short5 s5.f1: got %d but expected %d\n", s5
.f1
, 1);
6374 fprintf(stderr
, "mono_return_short5 s5.f2: got %d but expected %d\n", s5
.f2
, 2);
6377 fprintf(stderr
, "mono_return_short5 s5.f3: got %d but expected %d\n", s5
.f3
, 3);
6380 fprintf(stderr
, "mono_return_short5 s5.f4: got %d but expected %d\n", s5
.f4
, 4);
6383 fprintf(stderr
, "mono_return_short5 s5.f5: got %d but expected %d\n", s5
.f5
, 5);
6385 s5
.f1
+=addend
; s5
.f2
+=addend
; s5
.f3
+=addend
; s5
.f4
+=addend
; s5
.f5
+=addend
;
6390 short f1
,f2
,f3
,f4
,f5
,f6
;
6393 LIBTEST_API short6 STDCALL
6394 mono_return_short6 (short6 s6
, int addend
) {
6396 fprintf(stderr
, "mono_return_short6 s6.f1: got %d but expected %d\n", s6
.f1
, 1);
6399 fprintf(stderr
, "mono_return_short6 s6.f2: got %d but expected %d\n", s6
.f2
, 2);
6402 fprintf(stderr
, "mono_return_short6 s6.f3: got %d but expected %d\n", s6
.f3
, 3);
6405 fprintf(stderr
, "mono_return_short6 s6.f4: got %d but expected %d\n", s6
.f4
, 4);
6408 fprintf(stderr
, "mono_return_short6 s6.f5: got %d but expected %d\n", s6
.f5
, 5);
6411 fprintf(stderr
, "mono_return_short6 s6.f6: got %d but expected %d\n", s6
.f6
, 6);
6413 s6
.f1
+=addend
; s6
.f2
+=addend
; s6
.f3
+=addend
; s6
.f4
+=addend
; s6
.f5
+=addend
; s6
.f6
+=addend
;
6418 short f1
,f2
,f3
,f4
,f5
,f6
,f7
;
6421 LIBTEST_API short7 STDCALL
6422 mono_return_short7 (short7 s7
, int addend
) {
6424 fprintf(stderr
, "mono_return_short7 s7.f1: got %d but expected %d\n", s7
.f1
, 1);
6427 fprintf(stderr
, "mono_return_short7 s7.f2: got %d but expected %d\n", s7
.f2
, 2);
6430 fprintf(stderr
, "mono_return_short7 s7.f3: got %d but expected %d\n", s7
.f3
, 3);
6433 fprintf(stderr
, "mono_return_short7 s7.f4: got %d but expected %d\n", s7
.f4
, 4);
6436 fprintf(stderr
, "mono_return_short7 s7.f5: got %d but expected %d\n", s7
.f5
, 5);
6439 fprintf(stderr
, "mono_return_short7 s7.f6: got %d but expected %d\n", s7
.f6
, 6);
6442 fprintf(stderr
, "mono_return_short7 s7.f7: got %d but expected %d\n", s7
.f7
, 7);
6444 s7
.f1
+=addend
; s7
.f2
+=addend
; s7
.f3
+=addend
; s7
.f4
+=addend
; s7
.f5
+=addend
; s7
.f6
+=addend
; s7
.f7
+=addend
;
6449 short f1
,f2
,f3
,f4
,f5
,f6
,f7
,f8
;
6452 LIBTEST_API short8 STDCALL
6453 mono_return_short8 (short8 s8
, int addend
) {
6455 fprintf(stderr
, "mono_return_short8 s8.f1: got %d but expected %d\n", s8
.f1
, 1);
6458 fprintf(stderr
, "mono_return_short8 s8.f2: got %d but expected %d\n", s8
.f2
, 2);
6461 fprintf(stderr
, "mono_return_short8 s8.f3: got %d but expected %d\n", s8
.f3
, 3);
6464 fprintf(stderr
, "mono_return_short8 s8.f4: got %d but expected %d\n", s8
.f4
, 4);
6467 fprintf(stderr
, "mono_return_short8 s8.f5: got %d but expected %d\n", s8
.f5
, 5);
6470 fprintf(stderr
, "mono_return_short8 s8.f6: got %d but expected %d\n", s8
.f6
, 6);
6473 fprintf(stderr
, "mono_return_short8 s8.f7: got %d but expected %d\n", s8
.f7
, 7);
6476 fprintf(stderr
, "mono_return_short8 s8.f8: got %d but expected %d\n", s8
.f8
, 8);
6478 s8
.f1
+=addend
; s8
.f2
+=addend
; s8
.f3
+=addend
; s8
.f4
+=addend
; s8
.f5
+=addend
; s8
.f6
+=addend
; s8
.f7
+=addend
; s8
.f8
+=addend
;
6483 short f1
,f2
,f3
,f4
,f5
,f6
,f7
,f8
,f9
;
6486 LIBTEST_API short9 STDCALL
6487 mono_return_short9 (short9 s9
, int addend
) {
6489 fprintf(stderr
, "mono_return_short9 s9.f1: got %d but expected %d\n", s9
.f1
, 1);
6492 fprintf(stderr
, "mono_return_short9 s9.f2: got %d but expected %d\n", s9
.f2
, 2);
6495 fprintf(stderr
, "mono_return_short9 s9.f3: got %d but expected %d\n", s9
.f3
, 3);
6498 fprintf(stderr
, "mono_return_short9 s9.f4: got %d but expected %d\n", s9
.f4
, 4);
6501 fprintf(stderr
, "mono_return_short9 s9.f5: got %d but expected %d\n", s9
.f5
, 5);
6504 fprintf(stderr
, "mono_return_short9 s9.f6: got %d but expected %d\n", s9
.f6
, 6);
6507 fprintf(stderr
, "mono_return_short9 s9.f7: got %d but expected %d\n", s9
.f7
, 7);
6510 fprintf(stderr
, "mono_return_short9 s9.f8: got %d but expected %d\n", s9
.f8
, 8);
6513 fprintf(stderr
, "mono_return_short9 s9.f9: got %d but expected %d\n", s9
.f9
, 9);
6515 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
;
6523 short f2
,f3
,f4
,f5
,f6
,f7
;
6529 LIBTEST_API short8_nested STDCALL
6530 mono_return_short8_nested (short8_nested sn8
, int addend
) {
6531 if (sn8
.nested1
.f1
!= 1) {
6532 fprintf(stderr
, "mono_return_short8_nested sn8.nested1.f1: got %d but expected %d\n", sn8
.nested1
.f1
, 1);
6535 fprintf(stderr
, "mono_return_short8_nested sn8.f2: got %d but expected %d\n", sn8
.f2
, 2);
6538 fprintf(stderr
, "mono_return_short8_nested sn8.f3: got %d but expected %d\n", sn8
.f3
, 3);
6541 fprintf(stderr
, "mono_return_short8_nested sn8.f4: got %d but expected %d\n", sn8
.f4
, 4);
6544 fprintf(stderr
, "mono_return_short8_nested sn8.f5: got %d but expected %d\n", sn8
.f5
, 5);
6547 fprintf(stderr
, "mono_return_short8_nested sn8.f6: got %d but expected %d\n", sn8
.f6
, 6);
6550 fprintf(stderr
, "mono_return_short8_nested sn8.f7: got %d but expected %d\n", sn8
.f7
, 7);
6552 if (sn8
.nested2
.f8
!= 8) {
6553 fprintf(stderr
, "mono_return_short8_nested sn8.nested2.f8: got %d but expected %d\n", sn8
.nested2
.f8
, 8);
6555 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
;
6564 LIBTEST_API int1 STDCALL
6565 mono_return_int1 (int1 s1
, int addend
) {
6567 fprintf(stderr
, "mono_return_int1 s1.f1: got %d but expected %d\n", s1
.f1
, 1);
6577 LIBTEST_API int2 STDCALL
6578 mono_return_int2 (int2 s2
, int addend
) {
6580 fprintf(stderr
, "mono_return_int2 s2.f1: got %d but expected %d\n", s2
.f1
, 1);
6583 fprintf(stderr
, "mono_return_int2 s2.f2: got %d but expected %d\n", s2
.f2
, 2);
6585 s2
.f1
+=addend
; s2
.f2
+=addend
;
6593 LIBTEST_API int3 STDCALL
6594 mono_return_int3 (int3 s3
, int addend
) {
6596 fprintf(stderr
, "mono_return_int3 s3.f1: got %d but expected %d\n", s3
.f1
, 1);
6599 fprintf(stderr
, "mono_return_int3 s3.f2: got %d but expected %d\n", s3
.f2
, 2);
6602 fprintf(stderr
, "mono_return_int3 s3.f3: got %d but expected %d\n", s3
.f3
, 3);
6604 s3
.f1
+=addend
; s3
.f2
+=addend
; s3
.f3
+=addend
;
6612 LIBTEST_API int4 STDCALL
6613 mono_return_int4 (int4 s4
, int addend
) {
6615 fprintf(stderr
, "mono_return_int4 s4.f1: got %d but expected %d\n", s4
.f1
, 1);
6618 fprintf(stderr
, "mono_return_int4 s4.f2: got %d but expected %d\n", s4
.f2
, 2);
6621 fprintf(stderr
, "mono_return_int4 s4.f3: got %d but expected %d\n", s4
.f3
, 3);
6624 fprintf(stderr
, "mono_return_int4 s4.f4: got %d but expected %d\n", s4
.f4
, 4);
6626 s4
.f1
+=addend
; s4
.f2
+=addend
; s4
.f3
+=addend
; s4
.f4
+=addend
;
6634 LIBTEST_API int5 STDCALL
6635 mono_return_int5 (int5 s5
, int addend
) {
6637 fprintf(stderr
, "mono_return_int5 s5.f1: got %d but expected %d\n", s5
.f1
, 1);
6640 fprintf(stderr
, "mono_return_int5 s5.f2: got %d but expected %d\n", s5
.f2
, 2);
6643 fprintf(stderr
, "mono_return_int5 s5.f3: got %d but expected %d\n", s5
.f3
, 3);
6646 fprintf(stderr
, "mono_return_int5 s5.f4: got %d but expected %d\n", s5
.f4
, 4);
6649 fprintf(stderr
, "mono_return_int5 s5.f5: got %d but expected %d\n", s5
.f5
, 5);
6651 s5
.f1
+=addend
; s5
.f2
+=addend
; s5
.f3
+=addend
; s5
.f4
+=addend
; s5
.f5
+=addend
;
6665 LIBTEST_API int4_nested STDCALL
6666 mono_return_int4_nested (int4_nested sn4
, int addend
) {
6667 if (sn4
.nested1
.f1
!= 1) {
6668 fprintf(stderr
, "mono_return_int4_nested sn4.nested1.f1: got %d but expected %d\n", sn4
.nested1
.f1
, 1);
6671 fprintf(stderr
, "mono_return_int4_nested sn4.f2: got %d but expected %d\n", sn4
.f2
, 2);
6674 fprintf(stderr
, "mono_return_int4_nested sn4.f3: got %d but expected %d\n", sn4
.f3
, 3);
6676 if (sn4
.nested2
.f4
!= 4) {
6677 fprintf(stderr
, "mono_return_int4_nested sn4.nested2.f4: got %d but expected %d\n", sn4
.nested2
.f4
, 4);
6679 sn4
.nested1
.f1
+=addend
; sn4
.f2
+=addend
; sn4
.f3
+=addend
; sn4
.nested2
.f4
+=addend
;
6687 LIBTEST_API float1 STDCALL
6688 mono_return_float1 (float1 s1
, int addend
) {
6690 fprintf(stderr
, "mono_return_float1 s1.f1: got %f but expected %d\n", s1
.f1
, 1);
6700 LIBTEST_API float2 STDCALL
6701 mono_return_float2 (float2 s2
, int addend
) {
6703 fprintf(stderr
, "mono_return_float2 s2.f1: got %f but expected %d\n", s2
.f1
, 1);
6706 fprintf(stderr
, "mono_return_float2 s2.f2: got %f but expected %d\n", s2
.f2
, 2);
6708 s2
.f1
+=addend
; s2
.f2
+=addend
;
6716 LIBTEST_API float3 STDCALL
6717 mono_return_float3 (float3 s3
, int addend
) {
6719 fprintf(stderr
, "mono_return_float3 s3.f1: got %f but expected %d\n", s3
.f1
, 1);
6722 fprintf(stderr
, "mono_return_float3 s3.f2: got %f but expected %d\n", s3
.f2
, 2);
6725 fprintf(stderr
, "mono_return_float3 s3.f3: got %f but expected %d\n", s3
.f3
, 3);
6727 s3
.f1
+=addend
; s3
.f2
+=addend
; s3
.f3
+=addend
;
6735 LIBTEST_API float4 STDCALL
6736 mono_return_float4 (float4 s4
, int addend
) {
6738 fprintf(stderr
, "mono_return_float4 s4.f1: got %f but expected %d\n", s4
.f1
, 1);
6741 fprintf(stderr
, "mono_return_float4 s4.f2: got %f but expected %d\n", s4
.f2
, 2);
6744 fprintf(stderr
, "mono_return_float4 s4.f3: got %f but expected %d\n", s4
.f3
, 3);
6747 fprintf(stderr
, "mono_return_float4 s4.f4: got %f but expected %d\n", s4
.f4
, 4);
6749 s4
.f1
+=addend
; s4
.f2
+=addend
; s4
.f3
+=addend
; s4
.f4
+=addend
;
6754 float f1
,f2
,f3
,f4
,f5
;
6757 LIBTEST_API float5 STDCALL
6758 mono_return_float5 (float5 s5
, int addend
) {
6760 fprintf(stderr
, "mono_return_float5 s5.f1: got %f but expected %d\n", s5
.f1
, 1);
6763 fprintf(stderr
, "mono_return_float5 s5.f2: got %f but expected %d\n", s5
.f2
, 2);
6766 fprintf(stderr
, "mono_return_float5 s5.f3: got %f but expected %d\n", s5
.f3
, 3);
6769 fprintf(stderr
, "mono_return_float5 s5.f4: got %f but expected %d\n", s5
.f4
, 4);
6772 fprintf(stderr
, "mono_return_float5 s5.f5: got %f but expected %d\n", s5
.f5
, 5);
6774 s5
.f1
+=addend
; s5
.f2
+=addend
; s5
.f3
+=addend
; s5
.f4
+=addend
; s5
.f5
+=addend
;
6779 float f1
,f2
,f3
,f4
,f5
,f6
;
6782 LIBTEST_API float6 STDCALL
6783 mono_return_float6 (float6 s6
, int addend
) {
6785 fprintf(stderr
, "mono_return_float6 s6.f1: got %f but expected %d\n", s6
.f1
, 1);
6788 fprintf(stderr
, "mono_return_float6 s6.f2: got %f but expected %d\n", s6
.f2
, 2);
6791 fprintf(stderr
, "mono_return_float6 s6.f3: got %f but expected %d\n", s6
.f3
, 3);
6794 fprintf(stderr
, "mono_return_float6 s6.f4: got %f but expected %d\n", s6
.f4
, 4);
6797 fprintf(stderr
, "mono_return_float6 s6.f5: got %f but expected %d\n", s6
.f5
, 5);
6800 fprintf(stderr
, "mono_return_float6 s6.f6: got %f but expected %d\n", s6
.f6
, 6);
6802 s6
.f1
+=addend
; s6
.f2
+=addend
; s6
.f3
+=addend
; s6
.f4
+=addend
; s6
.f5
+=addend
; s6
.f6
+=addend
;
6807 float f1
,f2
,f3
,f4
,f5
,f6
,f7
;
6810 LIBTEST_API float7 STDCALL
6811 mono_return_float7 (float7 s7
, int addend
) {
6813 fprintf(stderr
, "mono_return_float7 s7.f1: got %f but expected %d\n", s7
.f1
, 1);
6816 fprintf(stderr
, "mono_return_float7 s7.f2: got %f but expected %d\n", s7
.f2
, 2);
6819 fprintf(stderr
, "mono_return_float7 s7.f3: got %f but expected %d\n", s7
.f3
, 3);
6822 fprintf(stderr
, "mono_return_float7 s7.f4: got %f but expected %d\n", s7
.f4
, 4);
6825 fprintf(stderr
, "mono_return_float7 s7.f5: got %f but expected %d\n", s7
.f5
, 5);
6828 fprintf(stderr
, "mono_return_float7 s7.f6: got %f but expected %d\n", s7
.f6
, 6);
6831 fprintf(stderr
, "mono_return_float7 s7.f7: got %f but expected %d\n", s7
.f7
, 7);
6833 s7
.f1
+=addend
; s7
.f2
+=addend
; s7
.f3
+=addend
; s7
.f4
+=addend
; s7
.f5
+=addend
; s7
.f6
+=addend
; s7
.f7
+=addend
;
6838 float f1
,f2
,f3
,f4
,f5
,f6
,f7
,f8
;
6841 LIBTEST_API float8 STDCALL
6842 mono_return_float8 (float8 s8
, int addend
) {
6844 fprintf(stderr
, "mono_return_float8 s8.f1: got %f but expected %d\n", s8
.f1
, 1);
6847 fprintf(stderr
, "mono_return_float8 s8.f2: got %f but expected %d\n", s8
.f2
, 2);
6850 fprintf(stderr
, "mono_return_float8 s8.f3: got %f but expected %d\n", s8
.f3
, 3);
6853 fprintf(stderr
, "mono_return_float8 s8.f4: got %f but expected %d\n", s8
.f4
, 4);
6856 fprintf(stderr
, "mono_return_float8 s8.f5: got %f but expected %d\n", s8
.f5
, 5);
6859 fprintf(stderr
, "mono_return_float8 s8.f6: got %f but expected %d\n", s8
.f6
, 6);
6862 fprintf(stderr
, "mono_return_float8 s8.f7: got %f but expected %d\n", s8
.f7
, 7);
6865 fprintf(stderr
, "mono_return_float8 s8.f8: got %f but expected %d\n", s8
.f8
, 8);
6867 s8
.f1
+=addend
; s8
.f2
+=addend
; s8
.f3
+=addend
; s8
.f4
+=addend
; s8
.f5
+=addend
; s8
.f6
+=addend
; s8
.f7
+=addend
; s8
.f8
+=addend
;
6872 float f1
,f2
,f3
,f4
,f5
,f6
,f7
,f8
,f9
;
6875 LIBTEST_API float9 STDCALL
6876 mono_return_float9 (float9 s9
, int addend
) {
6878 fprintf(stderr
, "mono_return_float9 s9.f1: got %f but expected %d\n", s9
.f1
, 1);
6881 fprintf(stderr
, "mono_return_float9 s9.f2: got %f but expected %d\n", s9
.f2
, 2);
6884 fprintf(stderr
, "mono_return_float9 s9.f3: got %f but expected %d\n", s9
.f3
, 3);
6887 fprintf(stderr
, "mono_return_float9 s9.f4: got %f but expected %d\n", s9
.f4
, 4);
6890 fprintf(stderr
, "mono_return_float9 s9.f5: got %f but expected %d\n", s9
.f5
, 5);
6893 fprintf(stderr
, "mono_return_float9 s9.f6: got %f but expected %d\n", s9
.f6
, 6);
6896 fprintf(stderr
, "mono_return_float9 s9.f7: got %f but expected %d\n", s9
.f7
, 7);
6899 fprintf(stderr
, "mono_return_float9 s9.f8: got %f but expected %d\n", s9
.f8
, 8);
6902 fprintf(stderr
, "mono_return_float9 s9.f9: got %f but expected %d\n", s9
.f9
, 9);
6904 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
;
6918 LIBTEST_API float4_nested STDCALL
6919 mono_return_float4_nested (float4_nested sn4
, int addend
) {
6920 if (sn4
.nested1
.f1
!= 1) {
6921 fprintf(stderr
, "mono_return_float4_nested sn4.nested1.f1: got %f but expected %d\n", sn4
.nested1
.f1
, 1);
6924 fprintf(stderr
, "mono_return_float4_nested sn4.f2: got %f but expected %d\n", sn4
.f2
, 2);
6927 fprintf(stderr
, "mono_return_float4_nested sn4.f3: got %f but expected %d\n", sn4
.f3
, 3);
6929 if (sn4
.nested2
.f4
!= 4) {
6930 fprintf(stderr
, "mono_return_float4_nested sn4.nested2.f4: got %f but expected %d\n", sn4
.nested2
.f4
, 4);
6932 sn4
.nested1
.f1
+=addend
; sn4
.f2
+=addend
; sn4
.f3
+=addend
; sn4
.nested2
.f4
+=addend
;
6940 LIBTEST_API double1 STDCALL
6941 mono_return_double1 (double1 s1
, int addend
) {
6943 fprintf(stderr
, "mono_return_double1 s1.f1: got %f but expected %d\n", s1
.f1
, 1);
6953 LIBTEST_API double2 STDCALL
6954 mono_return_double2 (double2 s2
, int addend
) {
6956 fprintf(stderr
, "mono_return_double2 s2.f1: got %f but expected %d\n", s2
.f1
, 1);
6959 fprintf(stderr
, "mono_return_double2 s2.f2: got %f but expected %d\n", s2
.f2
, 2);
6961 s2
.f1
+=addend
; s2
.f2
+=addend
;
6969 LIBTEST_API double3 STDCALL
6970 mono_return_double3 (double3 s3
, int addend
) {
6972 fprintf(stderr
, "mono_return_double3 s3.f1: got %f but expected %d\n", s3
.f1
, 1);
6975 fprintf(stderr
, "mono_return_double3 s3.f2: got %f but expected %d\n", s3
.f2
, 2);
6978 fprintf(stderr
, "mono_return_double3 s3.f3: got %f but expected %d\n", s3
.f3
, 3);
6980 s3
.f1
+=addend
; s3
.f2
+=addend
; s3
.f3
+=addend
;
6988 LIBTEST_API double4 STDCALL
6989 mono_return_double4 (double4 s4
, int addend
) {
6991 fprintf(stderr
, "mono_return_double4 s4.f1: got %f but expected %d\n", s4
.f1
, 1);
6994 fprintf(stderr
, "mono_return_double4 s4.f2: got %f but expected %d\n", s4
.f2
, 2);
6997 fprintf(stderr
, "mono_return_double4 s4.f3: got %f but expected %d\n", s4
.f3
, 3);
7000 fprintf(stderr
, "mono_return_double4 s4.f4: got %f but expected %d\n", s4
.f4
, 4);
7002 s4
.f1
+=addend
; s4
.f2
+=addend
; s4
.f3
+=addend
; s4
.f4
+=addend
;
7007 double f1
,f2
,f3
,f4
,f5
;
7010 LIBTEST_API double5 STDCALL
7011 mono_return_double5 (double5 s5
, int addend
) {
7013 fprintf(stderr
, "mono_return_double5 s5.f1: got %f but expected %d\n", s5
.f1
, 1);
7016 fprintf(stderr
, "mono_return_double5 s5.f2: got %f but expected %d\n", s5
.f2
, 2);
7019 fprintf(stderr
, "mono_return_double5 s5.f3: got %f but expected %d\n", s5
.f3
, 3);
7022 fprintf(stderr
, "mono_return_double5 s5.f4: got %f but expected %d\n", s5
.f4
, 4);
7025 fprintf(stderr
, "mono_return_double5 s5.f5: got %f but expected %d\n", s5
.f5
, 5);
7027 s5
.f1
+=addend
; s5
.f2
+=addend
; s5
.f3
+=addend
; s5
.f4
+=addend
; s5
.f5
+=addend
;
7032 double f1
,f2
,f3
,f4
,f5
,f6
;
7035 LIBTEST_API double6 STDCALL
7036 mono_return_double6 (double6 s6
, int addend
) {
7038 fprintf(stderr
, "mono_return_double6 s6.f1: got %f but expected %d\n", s6
.f1
, 1);
7041 fprintf(stderr
, "mono_return_double6 s6.f2: got %f but expected %d\n", s6
.f2
, 2);
7044 fprintf(stderr
, "mono_return_double6 s6.f3: got %f but expected %d\n", s6
.f3
, 3);
7047 fprintf(stderr
, "mono_return_double6 s6.f4: got %f but expected %d\n", s6
.f4
, 4);
7050 fprintf(stderr
, "mono_return_double6 s6.f5: got %f but expected %d\n", s6
.f5
, 5);
7053 fprintf(stderr
, "mono_return_double6 s6.f6: got %f but expected %d\n", s6
.f6
, 6);
7055 s6
.f1
+=addend
; s6
.f2
+=addend
; s6
.f3
+=addend
; s6
.f4
+=addend
; s6
.f5
+=addend
; s6
.f6
+=addend
;
7060 double f1
,f2
,f3
,f4
,f5
,f6
,f7
;
7063 LIBTEST_API double7 STDCALL
7064 mono_return_double7 (double7 s7
, int addend
) {
7066 fprintf(stderr
, "mono_return_double7 s7.f1: got %f but expected %d\n", s7
.f1
, 1);
7069 fprintf(stderr
, "mono_return_double7 s7.f2: got %f but expected %d\n", s7
.f2
, 2);
7072 fprintf(stderr
, "mono_return_double7 s7.f3: got %f but expected %d\n", s7
.f3
, 3);
7075 fprintf(stderr
, "mono_return_double7 s7.f4: got %f but expected %d\n", s7
.f4
, 4);
7078 fprintf(stderr
, "mono_return_double7 s7.f5: got %f but expected %d\n", s7
.f5
, 5);
7081 fprintf(stderr
, "mono_return_double7 s7.f6: got %f but expected %d\n", s7
.f6
, 6);
7084 fprintf(stderr
, "mono_return_double7 s7.f7: got %f but expected %d\n", s7
.f7
, 7);
7086 s7
.f1
+=addend
; s7
.f2
+=addend
; s7
.f3
+=addend
; s7
.f4
+=addend
; s7
.f5
+=addend
; s7
.f6
+=addend
; s7
.f7
+=addend
;
7091 double f1
,f2
,f3
,f4
,f5
,f6
,f7
,f8
;
7094 LIBTEST_API double8 STDCALL
7095 mono_return_double8 (double8 s8
, int addend
) {
7097 fprintf(stderr
, "mono_return_double8 s8.f1: got %f but expected %d\n", s8
.f1
, 1);
7100 fprintf(stderr
, "mono_return_double8 s8.f2: got %f but expected %d\n", s8
.f2
, 2);
7103 fprintf(stderr
, "mono_return_double8 s8.f3: got %f but expected %d\n", s8
.f3
, 3);
7106 fprintf(stderr
, "mono_return_double8 s8.f4: got %f but expected %d\n", s8
.f4
, 4);
7109 fprintf(stderr
, "mono_return_double8 s8.f5: got %f but expected %d\n", s8
.f5
, 5);
7112 fprintf(stderr
, "mono_return_double8 s8.f6: got %f but expected %d\n", s8
.f6
, 6);
7115 fprintf(stderr
, "mono_return_double8 s8.f7: got %f but expected %d\n", s8
.f7
, 7);
7118 fprintf(stderr
, "mono_return_double8 s8.f8: got %f but expected %d\n", s8
.f8
, 8);
7120 s8
.f1
+=addend
; s8
.f2
+=addend
; s8
.f3
+=addend
; s8
.f4
+=addend
; s8
.f5
+=addend
; s8
.f6
+=addend
; s8
.f7
+=addend
; s8
.f8
+=addend
;
7125 double f1
,f2
,f3
,f4
,f5
,f6
,f7
,f8
,f9
;
7128 LIBTEST_API double9 STDCALL
7129 mono_return_double9 (double9 s9
, int addend
) {
7131 fprintf(stderr
, "mono_return_double9 s9.f1: got %f but expected %d\n", s9
.f1
, 1);
7134 fprintf(stderr
, "mono_return_double9 s9.f2: got %f but expected %d\n", s9
.f2
, 2);
7137 fprintf(stderr
, "mono_return_double9 s9.f3: got %f but expected %d\n", s9
.f3
, 3);
7140 fprintf(stderr
, "mono_return_double9 s9.f4: got %f but expected %d\n", s9
.f4
, 4);
7143 fprintf(stderr
, "mono_return_double9 s9.f5: got %f but expected %d\n", s9
.f5
, 5);
7146 fprintf(stderr
, "mono_return_double9 s9.f6: got %f but expected %d\n", s9
.f6
, 6);
7149 fprintf(stderr
, "mono_return_double9 s9.f7: got %f but expected %d\n", s9
.f7
, 7);
7152 fprintf(stderr
, "mono_return_double9 s9.f8: got %f but expected %d\n", s9
.f8
, 8);
7155 fprintf(stderr
, "mono_return_double9 s9.f9: got %f but expected %d\n", s9
.f9
, 9);
7157 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
;
7170 LIBTEST_API double2_nested STDCALL
7171 mono_return_double2_nested (double2_nested sn2
, int addend
) {
7172 if (sn2
.nested1
.f1
!= 1) {
7173 fprintf(stderr
, "mono_return_double2_nested sn2.nested1.f1: got %f but expected %d\n", sn2
.nested1
.f1
, 1);
7175 if (sn2
.nested2
.f2
!= 2) {
7176 fprintf(stderr
, "mono_return_double2_nested sn2.nested2.f2: got %f but expected %d\n", sn2
.nested2
.f2
, 2);
7178 sn2
.nested1
.f1
+=addend
; sn2
.nested2
.f2
+=addend
;
7188 LIBTEST_API double_array4 STDCALL
7189 mono_return_double_array4 (double_array4 sa4
, int addend
) {
7190 if (sa4
.f1
[0] != 1) {
7191 fprintf(stderr
, "mono_return_double_array4 sa4.f1[0]: got %f but expected %d\n", sa4
.f1
[0], 1);
7193 if (sa4
.f1
[1] != 2) {
7194 fprintf(stderr
, "mono_return_double_array4 sa4.f1[1]: got %f but expected %d\n", sa4
.f1
[1], 2);
7196 if (sa4
.f1
[2] != 3) {
7197 fprintf(stderr
, "mono_return_double_array4 sa4.f1[2]: got %f but expected %d\n", sa4
.f1
[2], 3);
7199 if (sa4
.f1
[3] != 4) {
7200 fprintf(stderr
, "mono_return_double_array4 sa4.f1[3]: got %f but expected %d\n", sa4
.f1
[3], 4);
7202 sa4
.f1
[0]+=addend
; sa4
.f1
[1]+=addend
; sa4
.f1
[2]+=addend
; sa4
.f1
[3]+=addend
;