public static int test_0_marshal_delegate_struct() { DelegateStruct s = new DelegateStruct(); s.a = 2; s.del = new SimpleDelegate(delegate_test); s.del2 = new SimpleDelegate(delegate_test); s.del3 = null; DelegateStruct res = mono_test_marshal_delegate_struct(s); if (res.a != 0) { return(1); } if (res.del(2) != 0) { return(2); } if (res.del2(2) != 0) { return(3); } if (res.del3 != null) { return(4); } return(0); }
internal void MarshalWrapperToPtr(IntPtr ptr) { DelegateStruct func = new DelegateStruct(); func.mFunc = mWrapperFunc; Marshal.StructureToPtr(func, ptr, false); }
public static int Main() { int iret = 100; DelegateStruct ds = new DelegateStruct(); DelSt d = new DelSt(ds.DelMethod_Inline); TestStruct ts; ts.f1 = 1; ts.f2 = 1; TestStruct tr = d(ts, 10); Console.WriteLine("tr f1={0} f2={1}", tr.f1, tr.f2); if (tr.f1 != 10 || tr.f2 != 20) { Console.WriteLine("FAIL"); iret = 1; } else { Console.WriteLine("PASS"); } return iret; }
public static int Main() { int iret = 100; DelegateStruct ds = new DelegateStruct(); DelSt d = new DelSt(ds.DelMethod_Inline); TestStruct ts; ts.f1 = 1; ts.f2 = 1; TestStruct tr = d(ts, 10); Console.WriteLine("tr f1={0} f2={1}", tr.f1, tr.f2); if (tr.f1 != 10 || tr.f2 != 20) { Console.WriteLine("FAIL"); iret = 1; } else { Console.WriteLine("PASS"); } return(iret); }
public static extern DelegateStruct mono_test_marshal_delegate_struct(DelegateStruct d);
public static int test_0_marshal_delegate_struct() { DelegateStruct s = new DelegateStruct (); s.a = 2; s.del = new SimpleDelegate (delegate_test); s.del2 = new SimpleDelegate (delegate_test); DelegateStruct res = mono_test_marshal_delegate_struct (s); if (res.a != 0) return 1; if (res.del (2) != 0) return 2; if (res.del2 (2) != 0) return 3; return 0; }
internal void MarshalWrapperToPtr(IntPtr ptr) { DelegateStruct func = new DelegateStruct(); func.mFunc = mWrapperFunc; Marshal.StructureToPtr(func,ptr,false); }
static int test_0_marshal_delegate_struct() { DelegateStruct s = new DelegateStruct (); s.a = 2; s.del = new SimpleDelegate (delegate_test); s.del2 = new SimpleDelegate (delegate_test); return mono_test_marshal_delegate_struct (s); }