public static int test_0_arm64_gsharedvt_out_vtypebyref() { /* gsharedvt out trampoline with vtypebyref argument */ var s = new VTypeByRefStruct() { o1 = 1, o2 = 2, o3 = 3 }; // Call Foo2.Get_T directly, so its gets an instance Foo2 <VTypeByRefStruct> .Get_T(1.0f, s); var o = (IFaceFoo4 <VTypeByRefStruct>)Activator.CreateInstance(typeof(Foo4 <>).MakeGenericType(new Type [] { typeof(VTypeByRefStruct) })); // Call Foo4.Get_T, this will call the gsharedvt instance, which will call the non-gsharedvt instance var s_res = o.Get_T(1.0f, s); if (s_res.o1 != 1 || s_res.o2 != 2 || s_res.o3 != 3) { return(1); } // Same with the byref argument passed on the stack s_res = o.Get_T2(1.0f, s); if (s_res.o1 != 1 || s_res.o2 != 2 || s_res.o3 != 3) { return(2); } return(0); }
static int test_0_arm64_dyncall_vtypebyref_ret() { var s = new VTypeByRefStruct() { o1 = 1, o2 = 2, o3 = 3 }; Type t = typeof(Foo5 <>).MakeGenericType(new Type [] { typeof(VTypeByRefStruct) }); var o = Activator.CreateInstance(t); try { var s_res = (VTypeByRefStruct)t.GetMethod("Get_T").Invoke(o, new object [] { s }); if (s_res.o1 != 1 || s_res.o2 != 2 || s_res.o3 != 3) { return(1); } } catch (TargetInvocationException) { return(2); } return(0); }