public IntPtr MemAlloc(void *sz) { if (_MemAllocFnPtr == MemAllocFn) { goto Invoke; } _MemAllocFnPtr = MemAllocFn; _MemAllocFnDelegate = GetMemAllocFn(); Invoke: return((IntPtr)_MemAllocFnDelegate(sz)); }
public IntPtr SetMemAllocFn(MemAllocFn fn) { return(MemAllocFn = Marshal.GetFunctionPointerForDelegate(fn)); }