Exemplo n.º 1
0
        public static int FreeLibrary(IntPtr handle)
        {
            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Win32NT:
                return(WindowsLoader.FreeLibrary(handle));

            case PlatformID.Unix:
                if (BingoDllLoader.isMac())
                {
                    return(MacLoader.dlclose(handle));
                }
                else
                {
                    return(LinuxLoader.dlclose(handle));
                }
            }
            return(0);
        }
Exemplo n.º 2
0
        public static string GetLastError()
        {
            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Win32NT:
                return(WindowsLoader.GetLastError().ToString());

            case PlatformID.Unix:
                if (BingoDllLoader.isMac())
                {
                    return(MacLoader.dlerror());
                }
                else
                {
                    return(LinuxLoader.dlerror());
                }
            }
            return(null);
        }
Exemplo n.º 3
0
        public static IntPtr LoadLibrary(string filename)
        {
            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Win32NT:
                return(WindowsLoader.LoadLibrary(filename));

            case PlatformID.Unix:
                if (BingoDllLoader.isMac())
                {
                    return(MacLoader.dlopen(filename.Replace("\\", "/"), 0x8 | 0x1));    // RTLD_GLOBAL | RTLD_NOW
                }
                else
                {
                    return(LinuxLoader.dlopen(filename.Replace("\\", "/"), 0x00100 | 0x00002));    // RTLD_GLOBAL | RTLD_NOW
                }
            }
            return(IntPtr.Zero);
        }
Exemplo n.º 4
0
        public static IntPtr GetProcAddress(IntPtr library, string procedureName)
        {
            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Win32NT:
                return(WindowsLoader.GetProcAddress(library, procedureName));

            case PlatformID.Unix:
                if (BingoDllLoader.isMac())
                {
                    return(MacLoader.dlsym(library, procedureName));
                }
                else
                {
                    return(LinuxLoader.dlsym(library, procedureName));
                }
            }
            return(IntPtr.Zero);
        }