Exemplo n.º 1
0
        internal static T GetDelegateForFunction <T>(string functionName) where T : class
        {
            IntPtr fn = utils.GetProcAddress(dll, functionName);

            if (fn == IntPtr.Zero)
            {
                throw new MissingMethodException($"Function {functionName} is missing in {filename}");
            }

            return(Marshal.GetDelegateForFunctionPointer(fn, typeof(T)) as T);
        }