5 test_lpwstr_marshal (unsigned short* chars, long length)
9 printf("test_lpwstr_marshal()\n");
12 printf("X|%u|\n", chars[i++]);
23 int mono_union_test_1 (union_test_1_type u1) {
24 printf ("Got values %d %d %d\n", u1.b, u1.a, u1.c);
25 return u1.a + u1.b + u1.c;
28 int mono_return_int (int a) {
29 printf ("Got value %d\n", a);
32 int mono_test_many_int_arguments (int a, int b, int c, int d, int e,
33 int f, int g, int h, int i, int j);
34 short mono_test_many_short_arguments (short a, short b, short c, short d, short e,
35 short f, short g, short h, short i, short j);
36 char mono_test_many_char_arguments (char a, char b, char c, char d, char e,
37 char f, char g, char h, char i, char j);
40 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)
42 return a + b + c + d + e + f + g + h + i + j;
46 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)
48 return a + b + c + d + e + f + g + h + i + j;
52 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)
54 return a + b + c + d + e + f + g + h + i + j;
58 mono_test_puts_static (char *s)
60 printf ("TEST %s\n", s);
64 typedef int (*SimpleDelegate3) (int a, int b);
67 mono_invoke_delegate (SimpleDelegate3 delegate)
71 printf ("start invoke %p\n", delegate);
73 res = delegate (2, 3);
75 printf ("end invoke\n");
81 mono_test_marshal_char (short a1)
90 mono_test_marshal_array (int *a1)
94 for (i = 0; i < 50; i++)
108 mono_test_return_vtype ()
116 printf ("mono_test_return_vtype\n");
121 mono_test_delegate_struct ()
126 typedef simplestruct (*ReturnVTypeDelegate) (simplestruct ss);
129 mono_test_return_vtype2 (ReturnVTypeDelegate func)
138 printf ("mono_test_return_vtype2\n");
142 printf ("UA: %d\n", res1.a);
143 printf ("UB: %d\n", res1.b);
144 printf ("UC: %d\n", res1.c);
145 printf ("UD: %s\n", res1.d);
150 typedef char* (*ReturnStringDelegate) (char *s);
153 mono_test_return_string (ReturnStringDelegate func)
157 printf ("mono_test_return_string\n");
161 printf ("got string: %s\n", res);
165 typedef int (*RefVTypeDelegate) (int a, simplestruct *ss, int b);
168 mono_test_ref_vtype (int a, simplestruct *ss, int b, RefVTypeDelegate func)
170 if (a == 1 && b == 2 && ss->a == 0 && ss->b == 1 && ss->c == 0 &&
171 !strcmp (ss->d, "TEST1")) {
177 return func (a, ss, b);
189 mono_test_marshal_delegate_struct (DelegateStruct ds)
191 return ds.func (ds.a);
195 mono_test_marshal_struct (simplestruct ss)
197 if (ss.a == 0 && ss.b == 1 && ss.c == 0 &&
198 !strcmp (ss.d, "TEST"))
205 typedef int (*SimpleDelegate) (int a);
208 mono_test_marshal_delegate (SimpleDelegate delegate)
213 typedef int (*SimpleDelegate2) (simplestruct ss);
216 mono_test_marshal_delegate2 (SimpleDelegate2 delegate)
226 printf ("Calling delegate from unmanaged code\n");
228 printf ("GOT %d\n", res);
234 mono_test_marshal_stringbuilder (char *s, int n)
236 const char m[] = "This is my message. Isn't it nice?";
245 mono_test_marshal_string_array (char **array)
247 printf ("%p\n", array);
251 /* this does not work on Redhat gcc 2.96 */
254 mono_test_empty_struct (int a, EmptyStruct es, int b)
256 if (a == 1 && b == 2)
268 mono_test_byvalstr_gen (void)
273 ret = g_malloc(sizeof(ByValStrStruct));
274 memset(ret, 'a', sizeof(ByValStrStruct)-1);
275 ret->a[sizeof(ByValStrStruct)-1] = 0;
281 mono_test_byvalstr_check (ByValStrStruct* data, char* correctString)
285 ret = strcmp(data->a, correctString);
286 printf ("T1: %s\n", data->a);
287 printf ("T2: %s\n", correctString);