public static void Main () {
        {
            var d = new TBinaryOperator(Multiply);
            var fp = Marshal.GetFunctionPointerForDelegate(d);

            Console.WriteLine(CallBinaryOperator(fp, 5, 3));
        }

        {
            var d = new TReturnStructArgument(IncrementFields);
            var fp = Marshal.GetFunctionPointerForDelegate(d);

            var a = new TestStruct { I = 1, F = 2.5f };
            var b = CallReturnStructArgument(fp, a);

            Console.WriteLine("i={0} f={1:F4}", b.I, b.F);
        }
    }
    public static void Main()
    {
        {
            var d  = new TBinaryOperator(Multiply);
            var fp = Marshal.GetFunctionPointerForDelegate(d);

            Console.WriteLine(CallBinaryOperator(fp, 5, 3));
        }

        {
            var d  = new TReturnStructArgument(IncrementFields);
            var fp = Marshal.GetFunctionPointerForDelegate(d);

            var a = new TestStruct {
                I = 1, F = 2.5f
            };
            var b = CallReturnStructArgument(fp, a);

            Console.WriteLine("i={0} f={1:F4}", b.I, b.F);
        }
    }
示例#3
0
 public static extern TestStruct CallReturnStructArgument (TReturnStructArgument rsa, TestStruct s);
示例#4
0
 public static extern TestStruct CallReturnStructArgument(TReturnStructArgument rsa, TestStruct s);