X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Ftests%2Fpinvoke-2.2.cs;h=5b3081e44f3da3c1b7365cb72299644f1ade5e60;hb=HEAD;hp=039bcda994eabe1816fe9d2b2fadceb29eb66e25;hpb=4eb352bcb3ef7a71dc9ab62c5cd2d5e7598619f7;p=mono.git diff --git a/mono/tests/pinvoke-2.2.cs b/mono/tests/pinvoke-2.2.cs index 039bcda994e..5b3081e44f3 100644 --- a/mono/tests/pinvoke-2.2.cs +++ b/mono/tests/pinvoke-2.2.cs @@ -23,7 +23,7 @@ public class Tests { return i + j; } - static int test_0_marshal_cdecl_delegate () { + public static int test_0_marshal_cdecl_delegate () { CdeclDelegate d = new CdeclDelegate (cdecl_delegate); return mono_test_marshal_cdecl_delegate (d); @@ -34,11 +34,35 @@ public class Tests { delegate int AddDelegate (int i, int j); - static int test_4_get_delegate_for_function_pointer () { + public 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); } + + [DllImport ("libtest")] + public static extern int mono_return_int (int i); + + [DllImport ("libtest", EntryPoint="not_found")] + public static extern int not_found (int i); + + public delegate int SimpleDelegate (int i); + + [DllImport ("libtest")] + public static extern int mono_invoke_simple_delegate (SimpleDelegate d); + + public static int test_4_native_function_to_ftnptr () { + return mono_invoke_simple_delegate (mono_return_int); + } + + public static int test_0_native_function_to_ftnptr_not_found () { + try { + return mono_invoke_simple_delegate (not_found); + } catch (EntryPointNotFoundException) { + return 0; + } + } + }