Author: zoltan
Date: 2006-06-15 13:39:15 -0400 (Thu, 15 Jun 2006)
New Revision: 61762

Added:
   trunk/mono/mono/tests/pinvoke-2.2.cs
Removed:
   trunk/mono/mono/tests/pinvoke-2.cs
Modified:
   trunk/mono/mono/tests/Makefile.am
   trunk/mono/mono/tests/libtest.c
Log:
2006-06-15  Zoltan Varga  <[EMAIL PROTECTED]>

        * pinvoke-2.cs: Rename to pinvoke-2.2.cs.
        
        * Makefile.am (TEST_CS2_SRC): Add pinvoke-2.2.cs

        * pinvoke-2.2.cs libtest.c: Add Marshal.GetDelegateForFunctionPointer 
() tests.


Modified: trunk/mono/mono/tests/Makefile.am
===================================================================
--- trunk/mono/mono/tests/Makefile.am   2006-06-15 17:37:18 UTC (rev 61761)
+++ trunk/mono/mono/tests/Makefile.am   2006-06-15 17:39:15 UTC (rev 61762)
@@ -253,7 +253,7 @@
        test-enum-indstoreil.il \
        even-odd.il
 
-TEST_CS2_SRC = interlocked-2.2.cs
+TEST_CS2_SRC = interlocked-2.2.cs pinvoke-2.2.cs
 TEST_IL2_SRC = find-method.2.il
 
 TESTSI_CS=$(TEST_CS_SRC:.cs=.exe)

Modified: trunk/mono/mono/tests/libtest.c
===================================================================
--- trunk/mono/mono/tests/libtest.c     2006-06-15 17:37:18 UTC (rev 61761)
+++ trunk/mono/mono/tests/libtest.c     2006-06-15 17:39:15 UTC (rev 61762)
@@ -1822,6 +1822,18 @@
        return res;
 }
 
+STDCALL int
+add_delegate (int i, int j)
+{
+       return i + j;
+}
+
+STDCALL gpointer
+mono_test_marshal_return_fnptr (void)
+{
+       return &add_delegate;
+}
+
 /*
  * COM INTEROP TESTS
  */

Copied: trunk/mono/mono/tests/pinvoke-2.2.cs (from rev 61667, 
trunk/mono/mono/tests/pinvoke-2.cs)
===================================================================
--- trunk/mono/mono/tests/pinvoke-2.cs  2006-06-13 15:52:59 UTC (rev 61667)
+++ trunk/mono/mono/tests/pinvoke-2.2.cs        2006-06-15 17:39:15 UTC (rev 
61762)
@@ -0,0 +1,44 @@
+//
+// 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);
+       }
+
+       [DllImport ("libtest", EntryPoint="mono_test_marshal_return_fnptr")]
+       public static extern IntPtr mono_test_marshal_return_fnptr ();
+
+       delegate int AddDelegate (int i, int j);
+
+       static int test_4_get_delegate_for_function_pointer () {
+               IntPtr ptr = mono_test_marshal_return_fnptr ();
+
+               AddDelegate d = 
(AddDelegate)Marshal.GetDelegateForFunctionPointer (ptr, typeof (AddDelegate));
+
+               return d (2, 2);
+       }
+}

Deleted: trunk/mono/mono/tests/pinvoke-2.cs
===================================================================
--- trunk/mono/mono/tests/pinvoke-2.cs  2006-06-15 17:37:18 UTC (rev 61761)
+++ trunk/mono/mono/tests/pinvoke-2.cs  2006-06-15 17:39:15 UTC (rev 61762)
@@ -1,31 +0,0 @@
-//
-// 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

Reply via email to