| 47 | } |
| 48 | |
| 49 | bool PluginManager::loadPlugin(std::string_view _file) |
| 50 | { |
| 51 | #ifdef EMSCRIPTEN |
| 52 | return false; |
| 53 | #endif |
| 54 | MYGUI_ASSERT(mIsInitialise, getClassTypeName() << " used but not initialised"); |
| 55 | |
| 56 | // Load plugin library |
| 57 | DynLib* lib = DynLibManager::getInstance().load(_file); |
| 58 | if (!lib) |
| 59 | { |
| 60 | MYGUI_LOG(Error, "Plugin '" << _file << "' not found"); |
| 61 | return false; |
| 62 | } |
| 63 | |
| 64 | // Call startup function |
| 65 | DLL_START_PLUGIN pFunc = reinterpret_cast<DLL_START_PLUGIN>(lib->getSymbol("dllStartPlugin")); |
| 66 | if (!pFunc) |
| 67 | { |
| 68 | MYGUI_LOG(Error, "Cannot find symbol 'dllStartPlugin' in library " << _file); |
| 69 | return false; |
| 70 | } |
| 71 | |
| 72 | // Store for later unload |
| 73 | mLibs[lib->getName()] = lib; |
| 74 | |
| 75 | // This must call installPlugin |
| 76 | pFunc(); |
| 77 | |
| 78 | return true; |
| 79 | } |
| 80 | |
| 81 | void PluginManager::unloadPlugin(std::string_view _file) |
| 82 | { |
no test coverage detected