/// <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.");
        }
示例#2
0
 static IntPtr PlatformSpecificLoadLibrary(string libraryPath)
 {
     if (IsMacOS)
     {
         return(MacOSX.dlopen(libraryPath, RTLD_GLOBAL + RTLD_LAZY));
     }
     throw new InvalidOperationException("Unsupported platform.");
 }
示例#3
0
 /// <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.");
 }