internal static Delegate GetDelegate(CfxApiLoader.FunctionIndex apiIndex, Type delegateType) { IntPtr functionPtr = cfx_get_function_pointer((int)apiIndex); if(functionPtr == IntPtr.Zero) { throw new CfxException("Unable to load native function " + apiIndex.ToString() + "."); } return Marshal.GetDelegateForFunctionPointer(functionPtr, delegateType); }