2 using System.Runtime.InteropServices;
6 [DllImport ("libtest", EntryPoint="mono_test_marshal_delegate_struct")]
7 public static extern int mono_test_marshal_delegate_struct (DelegateStruct s);
9 public delegate int WndProc (int a);
11 public static int test_func (int a)
16 [StructLayout (LayoutKind.Sequential)]
17 public struct DelegateStruct {
22 public unsafe static int Main () {
23 DelegateStruct ss = new DelegateStruct ();
24 int size = Marshal.SizeOf (typeof (DelegateStruct));
26 Console.WriteLine ("DelegateStruct:" + size);
27 if (size != 2 * sizeof(void *)) // not right for 64 bit pointers which can be 4 byte aligned
31 ss.func = new WndProc(test_func);
33 if (mono_test_marshal_delegate_struct (ss) != 123)