Esempio n. 1
0
    private static void Test8ByteHFAReverse()
    {
        ThisCallNative.C     c      = CreateCWithManagedVTable(2.0f, 3.0f);
        ThisCallNative.SizeF result = ThisCallNative.GetSizeFromManaged(&c);

        Assert.AreEqual(c.width, result.width);
        Assert.AreEqual(c.height, result.height);
    }
Esempio n. 2
0
    private static void Test8ByteHFAUnmanagedCallersOnly()
    {
        ThisCallNative.C     c      = CreateCWithUnmanagedCallersOnlyVTable(2.0f, 3.0f);
        ThisCallNative.SizeF result = ThisCallNative.GetSizeFromManaged(&c);

        Assert.Equal(c.width, result.width);
        Assert.Equal(c.height, result.height);
    }
Esempio n. 3
0
    private static unsafe void Test8ByteHFA(ThisCallNative.C *instance)
    {
        ThisCallNative.GetSizeFn callback = Marshal.GetDelegateForFunctionPointer <ThisCallNative.GetSizeFn>(instance->vtable->getSize);

        ThisCallNative.SizeF result = callback(instance);

        Assert.AreEqual(instance->width, result.width);
        Assert.AreEqual(instance->height, result.height);
    }
Esempio n. 4
0
    public unsafe static int Main(string[] args)
    {
        try
        {
            float                    width    = 1.0f;
            float                    height   = 2.0f;
            ThisCallNative.C *       instance = ThisCallNative.CreateInstanceOfC(width, height);
            ThisCallNative.GetSizeFn callback = Marshal.GetDelegateForFunctionPointer <ThisCallNative.GetSizeFn>(instance->vtable->getSize);

            ThisCallNative.SizeF result = callback(instance);

            Assert.AreEqual(width, result.width);
            Assert.AreEqual(height, result.height);
        }
        catch (System.Exception ex)
        {
            Console.WriteLine(ex);
            return(101);
        }
        return(100);
    }