public static IntPtr LoadLibrary(string libname) { if (IsWindows) { return(Windows.LoadLibraryW(libname)); } return(IsOSX ? OSX.dlopen(libname, 1) : Linux.dlopen(libname, 1)); }
public static IntPtr LoadLibrary(string libname) { if (CurrentPlatform.OS == OS.Windows) { return(Windows.LoadLibraryW(libname)); } if (CurrentPlatform.OS == OS.MacOSX) { return(OSX.dlopen(libname, RTLD_GLOBAL | RTLD_LAZY)); } return(Linux.dlopen(libname, RTLD_GLOBAL | RTLD_LAZY)); }
public static IntPtr LoadLibrary(string libname) { if (IsWindows) { return(Windows.LoadLibraryW(libname)); } if (IsOSX) { return(OSX.dlopen(libname, RTLD_GLOBAL | RTLD_LAZY)); } return(Linux.dlopen(libname, RTLD_GLOBAL | RTLD_LAZY)); }
public static IntPtr LoadLibrary(string libname) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return(Windows.LoadLibraryW(libname)); } if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { return(OSX.dlopen(libname, RTLD_LAZY)); } return(Linux.dlopen(libname, RTLD_LAZY)); }
public static IntPtr LoadLibrary(string libname) { if (Environment.OSVersion.IsWindows()) { return(Windows.LoadLibraryW(libname)); } if (Environment.OSVersion.IsMacOSX()) { return(OSX.dlopen(libname, RTLD_LAZY)); } return(Linux.dlopen(libname, RTLD_LAZY)); }
public static IntPtr LoadLibrary(string libname) { if (Environment.OSVersion.Platform == PlatformID.Win32NT) { return(Windows.LoadLibraryW(libname)); } if (Environment.OSVersion.Platform == PlatformID.MacOSX) { return(OSX.dlopen(libname, RTLD_LAZY)); } return(Linux.dlopen(libname, RTLD_LAZY)); }
static NativeLibrary() { const int RTLD_NOW = 2; if (Platform.IsWindows) { Open = Windows.LoadLibrary; GetSymbol = Windows.GetProcAddress; } else if (Platform.IsOSX) { Open = f => OSX.dlopen(f, RTLD_NOW); GetSymbol = OSX.dlsym; } else if (Platform.IsLinux) { if (Platform.IsMono) { Open = f => Mono.dlopen(f, RTLD_NOW); GetSymbol = Mono.dlsym; } else if (Platform.IsNetCore) { Open = f => CoreCLR.dlopen(f, RTLD_NOW); GetSymbol = CoreCLR.dlsym; } else { Open = f => Linux.dlopen(f, RTLD_NOW); GetSymbol = Linux.dlsym; } } else { throw new PlatformNotSupportedException(); } }