private Delegate GetManagedDelegateForFunction(string functionName, Type delegateType, bool mustExist)
{
IntPtr pAddressOfFunctionToCall = NativeProxy.GetProcAddress(_dllHandle, functionName);
if (pAddressOfFunctionToCall == IntPtr.Zero)
{
if (mustExist)
{
throw new AGSEditorException("Function '" + functionName + "' not exported from plugin");
}
return(null);
}
return(Marshal.GetDelegateForFunctionPointer(pAddressOfFunctionToCall, delegateType));
}