MCPcopy Create free account
hub / github.com/OGRECave/ogre-next / loadPlugin

Method loadPlugin

OgreMain/src/OgreRoot.cpp:1454–1503  ·  view source on GitHub ↗

-----------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1452 }
1453 //-----------------------------------------------------------------------
1454 void Root::loadPlugin( const String &pluginName, const bool bOptional,
1455 const NameValuePairList *options )
1456 {
1457#if OGRE_PLATFORM != OGRE_PLATFORM_EMSCRIPTEN
1458 // Load plugin library
1459 DynLib *lib = DynLibManager::getSingleton().load( pluginName, bOptional );
1460
1461 // Store for later unload
1462 // Check for existence, because if called 2+ times DynLibManager returns existing entry
1463 if( std::find( mPluginLibs.begin(), mPluginLibs.end(), lib ) == mPluginLibs.end() )
1464 {
1465 mPluginLibs.push_back( lib );
1466
1467 if( lib->isLoaded() )
1468 {
1469 // Call startup function
1470# ifdef __GNUC__
1471 __extension__
1472# endif
1473 DLL_START_PLUGIN pFunc = (DLL_START_PLUGIN)lib->getSymbol( "dllStartPlugin" );
1474
1475 if( !pFunc )
1476 {
1477 OGRE_EXCEPT( Exception::ERR_ITEM_NOT_FOUND,
1478 "Cannot find symbol dllStartPlugin in library " + pluginName,
1479 "Root::loadPlugin" );
1480 }
1481
1482 try
1483 {
1484 // This must call installPlugin
1485 pFunc( options );
1486 }
1487 catch( Exception &e )
1488 {
1489 if( !bOptional )
1490 {
1491 throw;
1492 }
1493 else
1494 {
1495 LogManager::getSingleton().logMessage(
1496 "Optional Plugin " + pluginName + " failed with exception:", LML_CRITICAL );
1497 LogManager::getSingleton().logMessage( e.getFullDescription(), LML_CRITICAL );
1498 }
1499 }
1500 }
1501 }
1502#endif
1503 }
1504 //-----------------------------------------------------------------------
1505 void Root::unloadPlugin( const String &pluginName )
1506 {

Callers 2

EmbeddedMainFunction · 0.80
mainFunction · 0.80

Calls 8

findFunction · 0.85
getSymbolMethod · 0.80
loadMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
isLoadedMethod · 0.45
logMessageMethod · 0.45

Tested by

no test coverage detected