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); }
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); }
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); }
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); }