/// <summary> /// Loads library in a platform specific way. /// </summary> static IntPtr PlatformSpecificLoadLibrary(string libraryPath) { if (IsWindows) { return(Windows.LoadLibrary(libraryPath)); } if (IsLinux) { if (IsMono) { return(Mono.dlopen(libraryPath, RTLD_GLOBAL + RTLD_LAZY)); } if (IsNetCore) { return(CoreCLR.dlopen(libraryPath, RTLD_GLOBAL + RTLD_LAZY)); } return(Linux.dlopen(libraryPath, RTLD_GLOBAL + RTLD_LAZY)); } if (IsMacOSPlatform) { return(MacOSX.dlopen(libraryPath, RTLD_GLOBAL + RTLD_LAZY)); } throw new InvalidOperationException("Unsupported platform."); }
static IntPtr PlatformSpecificLoadLibrary(string libraryPath) { if (IsMacOS) { return(MacOSX.dlopen(libraryPath, RTLD_GLOBAL + RTLD_LAZY)); } throw new InvalidOperationException("Unsupported platform."); }
/// <summary> /// Loads library in a platform specific way. /// </summary> private static IntPtr PlatformSpecificLoadLibrary(string libraryPath) { if (PlatformApis.IsWindows) { return(Windows.LoadLibrary(libraryPath)); } if (PlatformApis.IsLinux) { return(Linux.dlopen(libraryPath, RTLD_GLOBAL + RTLD_LAZY)); } if (PlatformApis.IsMacOSX) { return(MacOSX.dlopen(libraryPath, RTLD_GLOBAL + RTLD_LAZY)); } throw new InvalidOperationException("Unsupported platform."); }