//----------------------------------------------------------------------- void DynLib::load() { // Log library load LogManager::getSingleton().logMessage("Loading library " + mName); String name = mName; #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_NACL // dlopen() does not add .so to the filename, like windows does for .dll if (name.find(".so") == String::npos) name += ".so"; #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE // dlopen() does not add .dylib to the filename, like windows does for .dll if (name.substr(name.length() - 6, 6) != ".dylib") name += ".dylib"; #elif OGRE_PLATFORM == OGRE_PLATFORM_WIN32 // Although LoadLibraryEx will add .dll itself when you only specify the library name, // if you include a relative path then it does not. So, add it to be sure. if (name.substr(name.length() - 4, 4) != ".dll") name += ".dll"; #endif mInst = (DYNLIB_HANDLE)DYNLIB_LOAD( name.c_str() ); if( !mInst ) OGRE_EXCEPT( Exception::ERR_INTERNAL_ERROR, "Could not load dynamic library " + mName + ". System Error: " + dynlibError(), "DynLib::load" ); }
void DynLib::unload() { if(!m_hInst) return; if(DYNLIB_UNLOAD(m_hInst)) { BS_EXCEPT(InternalErrorException, "Could not unload dynamic library " + mName + ". System Error: " + dynlibError()); } }
void DynLib::unload() { if (!h_inst) return; THEA_LOG << "Unloading library '" << getName() << '\''; if (THEA_DYNLIB_UNLOAD(h_inst)) throw Error("Could not unload dynamic library '" + getNameStr() + "' (" + dynlibError() + ')'); h_inst = NULL; ref_count = 0; }
void DynLib::load() { if(m_hInst) return; m_hInst = (DYNLIB_HANDLE)DYNLIB_LOAD(mName.c_str()); if(!m_hInst) { BS_EXCEPT(InternalErrorException, "Could not load dynamic library " + mName + ". System Error: " + dynlibError()); } }
//----------------------------------------------------------------------- void DynLib::load() { // Log library load LogManager::getSingleton().logMessage("Loading library " + mName); String name = mName; #if OGRE_PLATFORM == OGRE_PLATFORM_EMSCRIPTEN if (name.find(".js") == String::npos) name += ".js"; #elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_NACL // dlopen() does not add .so to the filename, like windows does for .dll if (name.find(".so") == String::npos) { name += ".so."; name += StringConverter::toString(OGRE_VERSION_MAJOR) + "."; name += StringConverter::toString(OGRE_VERSION_MINOR) + "."; name += StringConverter::toString(OGRE_VERSION_PATCH); } #elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE // dlopen() does not add .dylib to the filename, like windows does for .dll if (name.substr(name.find_last_of(".") + 1) != "dylib") name += ".dylib"; #elif OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WINRT // Although LoadLibraryEx will add .dll itself when you only specify the library name, // if you include a relative path then it does not. So, add it to be sure. if (name.substr(name.find_last_of(".") + 1) != "dll") name += ".dll"; #endif #ifdef _UNICODE std::wstring wStr(name.begin(), name.end()); mInst = (DYNLIB_HANDLE)DYNLIB_LOAD(wStr.c_str()); #else mInst = (DYNLIB_HANDLE)DYNLIB_LOAD(name.c_str()); #endif #if OGRE_PLATFORM == OGRE_PLATFORM_APPLE if (!mInst) { // Try again as a framework mInst = (DYNLIB_HANDLE)FRAMEWORK_LOAD(mName); } #endif if (!mInst) OGRE_EXCEPT( Exception::ERR_INTERNAL_ERROR, "Could not load dynamic library " + mName + ". System Error: " + dynlibError(), "DynLib::load"); }
//----------------------------------------------------------------------- void DynLib::unload() { // Log library unload LogManager::getSingleton().logMessage("Unloading library " + mName); if( DYNLIB_UNLOAD( mInst ) ) { OGRE_EXCEPT( Exception::ERR_INTERNAL_ERROR, "Could not unload dynamic library " + mName + ". System Error: " + dynlibError(), "DynLib::unload"); } }
void DynLib::load() { if (h_inst) { addRef(); return; } std::string name = DynLib_addExtension(getName()); THEA_LOG << "Loading library '" << getName() << '\''; h_inst = (THEA_DYNLIB_HANDLE)THEA_DYNLIB_LOAD(name.c_str()); if (!h_inst) throw Error("Could not load dynamic library '" + name + "' (" + dynlibError() + ')'); ref_count = 1; }
//----------------------------------------------------------------------- void DynLib::load() { // Log library load LogManager::getSingleton().logMessage("Loading library " + mName); std::string name = mName; #if OGRE_PLATFORM == OGRE_PLATFORM_LINUX // dlopen() does not add .so to the filename, like windows does for .dll if (name.substr(name.length() - 3, 3) != ".so") name += ".so"; #endif m_hInst = (DYNLIB_HANDLE)DYNLIB_LOAD( name.c_str() ); if( !m_hInst ) OGRE_EXCEPT( Exception::ERR_INTERNAL_ERROR, "Could not load dynamic library " + mName + ". System Error: " + dynlibError(), "DynLib::load" ); }
void DynLib::unload() { // Log library unload MYGUI_LOG(Info, "Unloading library " << mName); #if MYGUI_PLATFORM == MYGUI_PLATFORM_APPLE //APPLE SPECIFIC CODE HERE #else if (MYGUI_DYNLIB_UNLOAD(mInstance)) { MYGUI_EXCEPT("Could not unload dynamic library '" << mName << "'. System Error: " << dynlibError()); } #endif }
//----------------------------------------------------------------------- bool DynLib::unload() { // Log library unload GameLog::logMessage("Unloading library %s", m_name.c_str()); if( DYNLIB_UNLOAD( m_hInst ) ) { GameLog::errorMessage( "Could not unload dynamic library %s. System Error: %s", m_name.c_str(), dynlibError().c_str() ); return false; } return true; }
//----------------------------------------------------------------------- bool DynLib::load() { // Already loaded ? if( m_hInst != 0x0 ) return true; // Log library load GameLog::logMessage("Loading library %s", m_name.c_str()); std::string name = m_name; #if defined PLATFORM_LINUX // dlopen() does not add .so to the filename, like windows does for .dll // if (name.substr(name.length() - 3, 3) != ".so") // name += ".so"; #endif m_hInst = (DYNLIB_HANDLE)DYNLIB_LOAD( name.c_str() ); if( m_hInst == 0x0 ) { GameLog::errorMessage( "Could not load dynamic library %s. System Error: %s", m_name.c_str(), dynlibError().c_str() ); return false; } return true; }