IntPtr INativeLibraryLoader.LoadLibrary(string path) { Trace.WriteLine("Opening a library: " + path); try { int flags = GetDLOpenFlags(); var result = UnixLibraryLoader.dlopen(path, flags); Trace.WriteLine("Open result: " + result); if (result == IntPtr.Zero) { var lastError = dlerror(); Trace.WriteLine($"Failed to load native library \"{path}\".\r\nLast Error:{lastError}\r\nCheck inner exception and\\or windows event log."); } return(result); } catch (Exception ex) { var lastError = dlerror(); Trace.WriteLine($"Failed to load native library \"{path}\".\r\nLast Error:{lastError}\r\nCheck inner exception and\\or windows event log.\r\nInner Exception: {ex.ToString()}"); Trace.WriteLine(ex.ToString()); return(IntPtr.Zero); } }
IntPtr INativeLibraryLoader.FindFunction(IntPtr library, string function) { return(UnixLibraryLoader.dlsym(library, function)); }
bool INativeLibraryLoader.UnloadLibrary(IntPtr library) { return(UnixLibraryLoader.dlclose(library) == 0); }
public IntPtr LastError() { return(UnixLibraryLoader.dlerror()); }