public Unicorn(UcArch arch, UcMode mode) { _callbacks = new Dictionary <int, UnicornCallbackData>(); _callbackId = 0; var result = Marshal.AllocHGlobal(Marshal.SizeOf <IntPtr>()); var err = UcNative.UcOpen(arch, mode, result); if (err != UcErr.UC_ERR_OK) { throw new UcException($"Failed to create native Unicorn instance, error {err}.", err); } Handle = (IntPtr)Marshal.PtrToStructure(result, typeof(IntPtr)); }
public static extern UcErr UcOpen(UcArch arch, UcMode mode, IntPtr engine);