7 test_lpwstr_marshal (unsigned short* chars, long length)
12 res = malloc (2 * (length + 1));
14 printf("test_lpwstr_marshal()\n");
16 while ( i < length ) {
17 printf("X|%u|\n", chars[i]);
32 int mono_union_test_1 (union_test_1_type u1) {
33 printf ("Got values %d %d %d\n", u1.b, u1.a, u1.c);
34 return u1.a + u1.b + u1.c;
37 int mono_return_int (int a) {
38 printf ("Got value %d\n", a);
47 int mono_return_int_ss (struct ss a) {
48 printf ("Got value %d\n", a.i);
58 int mono_return_int_su (union su a) {
59 printf ("Got value %d\n", a.i1);
63 int mono_test_many_int_arguments (int a, int b, int c, int d, int e,
64 int f, int g, int h, int i, int j);
65 short mono_test_many_short_arguments (short a, short b, short c, short d, short e,
66 short f, short g, short h, short i, short j);
67 char mono_test_many_char_arguments (char a, char b, char c, char d, char e,
68 char f, char g, char h, char i, char j);
71 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)
73 return a + b + c + d + e + f + g + h + i + j;
77 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)
79 return a + b + c + d + e + f + g + h + i + j;
83 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)
85 return a + b + c + d + e + f + g + h + i + j;
89 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)
91 return a + b + c + d + e + f + g + h + i + j;
95 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)
97 return a + b + c + d + e + f + g + h + i + j;
101 mono_test_puts_static (char *s)
103 printf ("TEST %s\n", s);
107 typedef int (*SimpleDelegate3) (int a, int b);
110 mono_invoke_delegate (SimpleDelegate3 delegate)
114 printf ("start invoke %p\n", delegate);
116 res = delegate (2, 3);
118 printf ("end invoke\n");
124 mono_test_marshal_char (short a1)
133 mono_test_marshal_array (int *a1)
137 for (i = 0; i < 50; i++)
151 mono_test_return_vtype ()
159 printf ("mono_test_return_vtype\n");
164 mono_test_delegate_struct ()
169 typedef simplestruct (*ReturnVTypeDelegate) (simplestruct ss);
172 mono_test_return_vtype2 (ReturnVTypeDelegate func)
181 printf ("mono_test_return_vtype2\n");
185 printf ("UA: %d\n", res1.a);
186 printf ("UB: %d\n", res1.b);
187 printf ("UC: %d\n", res1.c);
188 printf ("UD: %s\n", res1.d);
193 typedef char* (*ReturnStringDelegate) (char *s);
196 mono_test_return_string (ReturnStringDelegate func)
200 printf ("mono_test_return_string\n");
204 printf ("got string: %s\n", res);
208 typedef int (*RefVTypeDelegate) (int a, simplestruct *ss, int b);
211 mono_test_ref_vtype (int a, simplestruct *ss, int b, RefVTypeDelegate func)
213 if (a == 1 && b == 2 && ss->a == 0 && ss->b == 1 && ss->c == 0 &&
214 !strcmp (ss->d, "TEST1")) {
220 return func (a, ss, b);
232 mono_test_marshal_delegate_struct (DelegateStruct ds)
234 return ds.func (ds.a);
238 mono_test_marshal_struct (simplestruct ss)
240 if (ss.a == 0 && ss.b == 1 && ss.c == 0 &&
241 !strcmp (ss.d, "TEST"))
259 mono_test_marshal_struct2 (simplestruct2 ss)
261 if (ss.a == 0 && ss.b == 1 && ss.c == 0 &&
262 !strcmp (ss.d, "TEST") &&
263 ss.e == 99 && ss.f == 1.5 && ss.g == 42 && ss.h == (guint64)123)
270 typedef int (*SimpleDelegate) (int a);
273 mono_test_marshal_delegate (SimpleDelegate delegate)
278 typedef int (*SimpleDelegate2) (simplestruct ss);
281 mono_test_marshal_delegate2 (SimpleDelegate2 delegate)
291 printf ("Calling delegate from unmanaged code\n");
293 printf ("GOT %d\n", res);
299 mono_test_marshal_stringbuilder (char *s, int n)
301 const char m[] = "This is my message. Isn't it nice?";
312 mono_test_marshal_string_array (char **array)
314 printf ("%p\n", array);
319 /* this does not work on Redhat gcc 2.96 */
321 mono_test_empty_struct (int a, EmptyStruct es, int b)
323 printf ("mono_test_empty_struct %d %d\n", a, b);
325 if (a == 1 && b == 2)
336 mono_test_byvalstr_gen (void)
341 ret = malloc(sizeof(ByValStrStruct));
342 memset(ret, 'a', sizeof(ByValStrStruct)-1);
343 ret->a[sizeof(ByValStrStruct)-1] = 0;
349 mono_test_byvalstr_check (ByValStrStruct* data, char* correctString)
353 ret = strcmp(data->a, correctString);
354 printf ("T1: %s\n", data->a);
355 printf ("T2: %s\n", correctString);
367 printf ("HEXDUMP DEFAULT VERSION\n");
370 for (i=0; i < 8; ++i)
373 printf("%0x ", (int) *(p++));
386 printf ("HEXDUMP ANSI VERSION\n");
389 for (i=0; i < 8; ++i)
392 printf("%0x ", (int) *(p++));
400 HexDump1W(char *data)
405 printf ("HEXDUMP UNICODE VERSION\n");
408 for (i=0; i < 8; ++i)
411 printf("%0x ", (int) *(p++));
415 return res + 1000000;
418 typedef int (*intcharFunc)(char*);
421 callFunction (intcharFunc f)
427 printInt (int* number)
429 printf( "<%d>\n", *number );
440 class_marshal_test0 (SimpleObj *obj1)
442 printf ("class_marshal_test0 %s %d\n", obj1->str, obj1->i);
444 if (strcmp(obj1->str, "T1"))
453 class_marshal_test4 (SimpleObj *obj1)
462 class_marshal_test1 (SimpleObj **obj1)
464 SimpleObj *res = malloc (sizeof (SimpleObj));
473 class_marshal_test2 (SimpleObj **obj1)
475 printf ("class_marshal_test2 %s %d\n", (*obj1)->str, (*obj1)->i);
477 if (strcmp((*obj1)->str, "ABC"))
486 string_marshal_test0 (char *str)
488 if (strcmp (str, "TEST0"))
495 string_marshal_test1 (char **str)
501 string_marshal_test2 (char **str)
503 printf ("string_marshal_test2 %s\n", *str);
505 if (strcmp (*str, "TEST1"))
512 string_marshal_test3 (char *str)
521 functionReturningString (void)
532 VectorList* TestVectorList (VectorList *vl)
534 printf ("TestVectorList %d %d\n", vl->a, vl->b);
543 typedef struct _OSVERSIONINFO
550 GetVersionEx (OSVERSIONINFO *osvi)
553 printf ("GOT %d %d\n", osvi->a, osvi->b);
558 return osvi->a + osvi->b;