Author: zoltan
Date: 2005-05-01 09:24:58 -0400 (Sun, 01 May 2005)
New Revision: 43840
Added:
trunk/mono/mono/tests/pinvoke-2.cs
Modified:
trunk/mono/mono/tests/ChangeLog
trunk/mono/mono/tests/libtest.c
Log:
2005-05-01 Zoltan Varga <[EMAIL PROTECTED]>
* libtest.c (mono_test_marshal_cdecl_delegate): New test for changing
the calling convention of
a delegate.
* pinvoke-2.cs: New file for 2.0 pinvoke tests.
Modified: trunk/mono/mono/tests/ChangeLog
===================================================================
--- trunk/mono/mono/tests/ChangeLog 2005-05-01 13:23:22 UTC (rev 43839)
+++ trunk/mono/mono/tests/ChangeLog 2005-05-01 13:24:58 UTC (rev 43840)
@@ -1,3 +1,10 @@
+2005-05-01 Zoltan Varga <[EMAIL PROTECTED]>
+
+ * libtest.c (mono_test_marshal_cdecl_delegate): New test for changing
the calling convention of
+ a delegate.
+
+ * pinvoke-2.cs: New file for 2.0 pinvoke tests.
+
2005-04-22 Raja R Harinath <[EMAIL PROTECTED]>
* Makefile.am (CSC): Use '-unsafe' instead of '--unsafe'.
Modified: trunk/mono/mono/tests/libtest.c
===================================================================
--- trunk/mono/mono/tests/libtest.c 2005-05-01 13:23:22 UTC (rev 43839)
+++ trunk/mono/mono/tests/libtest.c 2005-05-01 13:24:58 UTC (rev 43840)
@@ -1614,3 +1614,15 @@
return del (len, NULL, arr);
}
+typedef int (*CdeclDelegate) (int i, int j);
+
+STDCALL int
+mono_test_marshal_cdecl_delegate (CdeclDelegate del)
+{
+ int i;
+
+ for (i = 0; i < 1000; ++i)
+ del (1, 2);
+
+ return 0;
+}
Added: trunk/mono/mono/tests/pinvoke-2.cs
===================================================================
--- trunk/mono/mono/tests/pinvoke-2.cs 2005-05-01 13:23:22 UTC (rev 43839)
+++ trunk/mono/mono/tests/pinvoke-2.cs 2005-05-01 13:24:58 UTC (rev 43840)
@@ -0,0 +1,31 @@
+//
+// pinvoke-2.cs:
+//
+// Tests for net 2.0 pinvoke features
+//
+
+using System;
+using System.Runtime.InteropServices;
+
+public class Tests {
+
+ public static int Main () {
+ return TestDriver.RunTests (typeof (Tests));
+ }
+
+ [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
+ public delegate int CdeclDelegate (int i, int j);
+
+ [DllImport ("libtest", EntryPoint="mono_test_marshal_cdecl_delegate")]
+ public static extern int mono_test_marshal_cdecl_delegate
(CdeclDelegate d);
+
+ public static int cdecl_delegate (int i, int j) {
+ return i + j;
+ }
+
+ static int test_0_marshal_cdecl_delegate () {
+ CdeclDelegate d = new CdeclDelegate (cdecl_delegate);
+
+ return mono_test_marshal_cdecl_delegate (d);
+ }
+}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches