+2003-10-06 Zoltan Varga <vargaz@freemail.hu>
+
+ * mono/tests/pinvoke2.cs mono/tests/libtest.c: Add array of structs
+ marshalling test.
+
2003-10-04 Bernie Solomon <bernard@ugsolutions.com>
* mono/tests/libtest.c: remove warnings except
return 1;
}
+int
+mono_test_marshal_struct_array (simplestruct2 *ss)
+{
+ if (ss[0].a == 0 && ss[0].b == 1 && ss[0].c == 0 &&
+ !strcmp (ss[0].d, "TEST") &&
+ ss[0].e == 99 && ss[0].f == 1.5 && ss[0].g == 42 && ss[0].h == (guint64)123)
+ return 0;
+
+ if (ss[1].a == 0 && ss[1].b == 1 && ss[1].c == 0 &&
+ !strcmp (ss[1].d, "TEST") &&
+ ss[1].e == 99 && ss[1].f == 1.5 && ss[1].g == 42 && ss[1].h == (guint64)123)
+ return 0;
+
+ return 1;
+}
typedef int (*SimpleDelegate) (int a);
[DllImport ("libtest", EntryPoint="mono_test_marshal_struct2")]
public static extern int mono_test_marshal_struct2 (SimpleStruct2 ss);
+ [DllImport ("libtest", EntryPoint="mono_test_marshal_struct_array")]
+ public static extern int mono_test_marshal_struct_array (SimpleStruct2[] ss);
+
[DllImport ("libtest", EntryPoint="mono_test_marshal_delegate")]
public static extern int mono_test_marshal_delegate (SimpleDelegate d);
ss2.f = 1.5;
ss2.g = 42;
ss2.h = 123L;
+
if (mono_test_marshal_struct2 (ss2) != 0)
return 4;
+
+ SimpleStruct2[] ss_arr = new SimpleStruct2 [2];
+ ss_arr [0] = ss2;
+ ss_arr [1] = ss2;
+
+ if (mono_test_marshal_struct_array (ss_arr) != 0)
+ return 5;
SimpleDelegate d = new SimpleDelegate (delegate_test);
if (mono_test_marshal_delegate (d) != 0)
- return 5;
+ return 6;
return 0;
}