private static void RegisterNativeEventHandles() { int size = Marshal.SizeOf(typeof(NativeEventHandles)); IntPtr ptr = Marshal.AllocHGlobal(size); Marshal.StructureToPtr(eventHandles, ptr, false); NativeFunctions.RegisterHandlers(ptr, (uint)size); Marshal.FreeHGlobal(ptr); }
private static void RegisterEventHandles(ICoreEventHandler eventHandler) { eventHandles.MainLoop = eventHandler.OnMainLoop; eventHandles.RunScript = eventHandler.OnRunScript; eventHandles.Closure = eventHandler.OnClosure; eventHandles.Signal = eventHandler.OnSignal; int size = Marshal.SizeOf(typeof(NativeEventHandles)); IntPtr ptr = Marshal.AllocHGlobal(size); Marshal.StructureToPtr(eventHandles, ptr, false); NativeFunctions.RegisterHandlers(ptr, (uint)size); Marshal.FreeHGlobal(ptr); }