示例#1
0
    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);
    }
示例#2
0
    static int test_0_arm64_dyncall_gsharedvt_out_hfa_float()
    {
        /* gsharedvt out trampoline with double hfa argument */
        double arg1 = 1.0f;

        var s = new Struct2();

        s.a = 1.0f;
        s.b = 2.0f;
        // Call Foo2.Get_T directly, so its gets an instance
        Foo2 <Struct2> .Get_T(arg1, s);

        Type t = typeof(Foo3 <>).MakeGenericType(new Type [] { typeof(Struct2) });
        // Call Foo3.Get_T, this will call the gsharedvt instance, which will call the non-gsharedvt instance
        var s_res = (Struct2)t.GetMethod("Get_T").Invoke(null, new object [] { arg1, s });

        if (s_res.a != 1.0f || s_res.b != 2.0f)
        {
            return(1);
        }
        return(0);
    }
示例#3
0
 public static T Get_T(double d, T t)
 {
     return(Foo2 <T> .Get_T(d, t));
 }