[DllImport ("libtest", EntryPoint="mono_test_marshal_delegate_ref_delegate")]
public static extern int mono_test_marshal_delegate_ref_delegate (DelegateByrefDelegate del);
+ [DllImport ("libtest", EntryPoint="mono_test_marshal_virtual_delegate")]
+ public static extern int mono_test_marshal_virtual_delegate (VirtualDelegate del);
+
+ [DllImport ("libtest", EntryPoint="mono_test_marshal_icall_delegate")]
+ public static extern int mono_test_marshal_icall_delegate (IcallDelegate del);
+
+ public delegate string IcallDelegate (IntPtr p);
+
public delegate int TestDelegate (int a, ref SimpleStruct ss, int b);
public delegate SimpleStruct SimpleDelegate2 (SimpleStruct ss);
public delegate int DelegateByrefDelegate (ref return_int_delegate del);
+ public delegate int VirtualDelegate (int i);
+
public static int Main () {
return TestDriver.RunTests (typeof (Tests));
}
return 0;
}
}
+
+ class Base {
+ public VirtualDelegate get_del () {
+ return delegate_test;
+ }
+
+ public virtual int delegate_test (int i) {
+ return i;
+ }
+ }
+
+ class Derived : Base {
+ public override int delegate_test (int i) {
+ return i + 1;
+ }
+ }
+
+ public static int test_43_virtual () {
+ Base b = new Derived ();
+
+ return mono_test_marshal_virtual_delegate (b.get_del ());
+ }
+
+ public static int test_0_icall_delegate () {
+ var m = typeof (Marshal).GetMethod ("PtrToStringAnsi", new Type[] { typeof (IntPtr) });
+
+ return mono_test_marshal_icall_delegate ((IcallDelegate)Delegate.CreateDelegate (typeof (IcallDelegate), m));
+ }
}