示例#1
0
        protected IntPtr Load(int slot, string entryPoint)
        {
            var ptr = _entryPoints[slot];

            if (ptr != IntPtr.Zero)
            {
                return(ptr);
            }

            ptr = _lib.LoadFunction(entryPoint);
            if (ptr == IntPtr.Zero)
            {
                throw new EntryPointNotFoundException($"Native symbol \"{entryPoint}\" not found (slot M{slot})");
            }

            _entryPoints[slot] = ptr;
            return(ptr);
        }
示例#2
0
 public bool TryGetProcAddress(string proc, out nint addr, int?slot = default)
 {
     addr = _lib.LoadFunction(proc);
     return(addr != 0);
 }