Пример #1
0
        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();
        }
Пример #2
0
        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();
        }
Пример #3
0
        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();
        }