Beispiel #1
0
        private static BingoLib getLib(Indigo indigo)
        {
            String          dllpath = indigo.getDllPath();
            string          libraryName;
            IndigoDllLoader dll_loader = IndigoDllLoader.Instance;

            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Win32NT:
                libraryName = "bingo.dll";
                dll_loader.loadLibrary(dllpath, libraryName, "com.epam.indigo.Properties.ResourcesWin", false);
                break;

            case PlatformID.Unix:
                if (IndigoDllLoader.isMac())
                {
                    libraryName = "libbingo.dylib";
                    dll_loader.loadLibrary(dllpath, libraryName, "com.epam.indigo.Properties.ResourcesMac", false);
                }
                else
                {
                    libraryName = "libbingo.so";
                    dll_loader.loadLibrary(dllpath, libraryName, "com.epam.indigo.Properties.ResourcesLinux", false);
                }
                break;

            default:
                throw new PlatformNotSupportedException(String.Format("Unsupported platform: {0}", Environment.OSVersion.Platform));
            }

            return(dll_loader.getInterface <BingoLib>(libraryName));
        }
Beispiel #2
0
        private void init(string lib_path)
        {
            string libraryName;

            dll_loader = IndigoDllLoader.Instance;
            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Win32NT:
                libraryName = "indigo.dll";

                bool vs2013 = true;
                bool vs2015 = true;

                try
                {
                    dll_loader.loadLibrary(lib_path, "msvcr120.dll", "com.epam.indigo.Properties.ResourcesWin2013", false);
                }
                catch
                {
                    vs2013 = false;
                }
                try
                {
                    dll_loader.loadLibrary(lib_path, "vcruntime140.dll", "com.epam.indigo.Properties.ResourcesWin2015", false);
                }
                catch
                {
                    vs2015 = false;
                }

                if (vs2013)
                {
                    dll_loader.loadLibrary(lib_path, "msvcr120.dll", "com.epam.indigo.Properties.ResourcesWin2013", false);
                    dll_loader.loadLibrary(lib_path, "msvcp120.dll", "com.epam.indigo.Properties.ResourcesWin2013", false);
                    dll_loader.loadLibrary(lib_path, libraryName, "com.epam.indigo.Properties.ResourcesWin2013", false);
                }
                else if (vs2015)
                {
                    dll_loader.loadLibrary(lib_path, "vcruntime140.dll", "com.epam.indigo.Properties.ResourcesWin2015", false);
                    dll_loader.loadLibrary(lib_path, "msvcp140.dll", "com.epam.indigo.Properties.ResourcesWin2015", false);
                    dll_loader.loadLibrary(lib_path, libraryName, "com.epam.indigo.Properties.ResourcesWin2015", false);
                }

                break;

            case PlatformID.Unix:
                if (IndigoDllLoader.isMac())
                {
                    libraryName = "libindigo.dylib";
                    dll_loader.loadLibrary(lib_path, libraryName, "com.epam.indigo.Properties.ResourcesMac", false);
                }
                else
                {
                    libraryName = "libindigo.so";
                    dll_loader.loadLibrary(lib_path, libraryName, "com.epam.indigo.Properties.ResourcesLinux", false);
                }
                break;

            default:
                throw new PlatformNotSupportedException(String.Format("Unsupported platform: {0}", Environment.OSVersion.Platform));
            }

            // Save instance id to check if session was allocated for this instance
            _dll_loader_id = IndigoDllLoader.InstanceId;

            _dllpath = lib_path;

            _indigo_lib = dll_loader.getInterface <IndigoLib>(libraryName);

            _sid = _indigo_lib.indigoAllocSessionId();
            _indigo_lib.indigoSetSessionId(_sid);
        }