public static bool FreeLibrary(IntPtr hLibrary) { if (MiscHelpers.PlatformIsWindows()) { return(NativeWindowsMethods.FreeLibrary(hLibrary)); } if (MiscHelpers.PlatformIsLinux()) { return(NativeLinuxMethods.FreeLibrary(hLibrary) == 0); } if (MiscHelpers.PlatformIsOSX()) { return(NativeOSXMethods.FreeLibrary(hLibrary) == 0); } throw new PlatformNotSupportedException(); }
public static string GetLoadLibraryErrorMessage() { if (MiscHelpers.PlatformIsWindows()) { return(new Win32Exception().Message); } if (MiscHelpers.PlatformIsLinux()) { return(Marshal.PtrToStringAnsi(NativeLinuxMethods.GetLoadLibraryErrorMessage())); } if (MiscHelpers.PlatformIsOSX()) { return(Marshal.PtrToStringAnsi(NativeOSXMethods.GetLoadLibraryErrorMessage())); } throw new PlatformNotSupportedException(); }
public static IntPtr LoadLibrary(string path) { if (MiscHelpers.PlatformIsWindows()) { return(NativeWindowsMethods.LoadLibraryW(path)); } if (MiscHelpers.PlatformIsLinux()) { return(NativeLinuxMethods.LoadLibrary(path)); } if (MiscHelpers.PlatformIsOSX()) { return(NativeOSXMethods.LoadLibrary(path)); } throw new PlatformNotSupportedException(); }