2003-10-10 Zoltan Varga <vargaz@freemail.hu>
authorZoltan Varga <vargaz@gmail.com>
Fri, 10 Oct 2003 12:41:23 +0000 (12:41 -0000)
committerZoltan Varga <vargaz@gmail.com>
Fri, 10 Oct 2003 12:41:23 +0000 (12:41 -0000)
* mono/tests/libtest.c (mono_test_marshal_delegate): Added test for
stdcall calling convention.

svn path=/trunk/mono/; revision=18859

ChangeLog
mono/tests/libtest.c

index 9e2faeeb70c224fdf057001f5aea2c4e759a0e67..ba73bb854422843f0418f9153547ca959e7d46dd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-10-10  Zoltan Varga  <vargaz@freemail.hu>
+
+       * mono/tests/libtest.c (mono_test_marshal_delegate): Added test for
+       stdcall calling convention.
+
 2003-10-09  Dick Porter  <dick@ximian.com>
 
        * acconfig.h:
index 4d626cf885cf4e2f1ae303616b83d2e4fce6f1ef..30ca4513894a4db646b47a1dc5f927ee961da4d5 100644 (file)
@@ -87,7 +87,7 @@ struct sc5
 };
 
 struct sc5 mono_return_sc5 (struct sc5 a) {
-       printf ("Got values %d %d %d\n", a.c[0], a.c[1], a.c[2], a.c[3], a.c[4]);
+       printf ("Got values %d %d %d %d %d\n", a.c[0], a.c[1], a.c[2], a.c[3], a.c[4]);
        a.c[0]++;
        a.c[1] += 2;
        a.c[2] += 3;
@@ -176,6 +176,22 @@ mono_test_marshal_char (short a1)
        return 1;
 }
 
+int
+mono_test_empty_pinvoke (int i)
+{
+       return i;
+}
+
+int 
+mono_test_marshal_bool_byref (int a, char *b, int c)
+{
+    int res = *b;
+
+       *b = 1;
+
+       return res;
+}
+
 int 
 mono_test_marshal_array (int *a1)
 {
@@ -343,11 +359,34 @@ mono_test_marshal_struct_array (simplestruct2 *ss)
        return 0;
 }
 
+#ifdef WIN32
+typedef int (__stdcall *SimpleDelegate) (int a);
+#else
 typedef int (*SimpleDelegate) (int a);
+#endif
+
+static void *
+get_sp (void)
+{
+       int i;
+       void *p;
+
+       p = &i;
+       return p;
+}
 
 int
 mono_test_marshal_delegate (SimpleDelegate delegate)
 {
+       void *sp1, *sp2;
+
+       /* Check that the delegate wrapper is stdcall */
+       delegate (2);
+       sp1 = get_sp ();
+       delegate (2);
+       sp2 = get_sp ();
+       g_assert (sp1 == sp2);
+
        return delegate (2);
 }