MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / loadModule

Method loadModule

src/yvalve/PluginManager.cpp:958–1007  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

956 }
957
958 RefPtr<PluginModule> PluginSet::loadModule(const PluginLoadInfo& info)
959 {
960 PathName fixedModuleName(info.curModule);
961 ISC_STATUS_ARRAY statusArray;
962
963 ModuleLoader::Module* module = nullptr;
964 int step = 0;
965 bool bad = false;
966
967 do
968 {
969 module = ModuleLoader::loadModule(statusArray, fixedModuleName);
970 } while (module == nullptr && // break on success
971 !(bad = ModuleLoader::isLoadableModule(fixedModuleName)) && // Break if module is found but is bad
972 ModuleLoader::doctorModuleExtension(fixedModuleName, step)); // Break if no further modifications of name is available
973
974 if (!module)
975 {
976 if (bad)
977 {
978 loadError(Arg::Gds(isc_pman_module_bad) << fixedModuleName <<
979 Arg::StatusVector(statusArray));
980 }
981 if (info.required)
982 {
983 loadError(Arg::Gds(isc_pman_module_notfound) << fixedModuleName <<
984 Arg::StatusVector(statusArray));
985 }
986
987 return RefPtr<PluginModule>(NULL);
988 }
989
990 RefPtr<PluginModule> rc(FB_NEW PluginModule(module, info.curModule));
991 typedef void PluginEntrypoint(IMaster* masterInterface);
992 PluginEntrypoint* startModule;
993 ISC_STATUS_ARRAY stArray;
994 if (module->findSymbol(stArray, STRINGIZE(FB_PLUGIN_ENTRY_POINT), startModule))
995 {
996 current = rc;
997 startModule(masterInterface);
998 current = NULL;
999#ifdef DARWIN // Plugin unload disabled in MacOS - GH-7112
1000 rc->addRef();
1001#endif
1002 return rc;
1003 }
1004
1005 loadError(Arg::Gds(isc_pman_entrypoint_notfound) << fixedModuleName << Arg::StatusVector(stArray));
1006 return RefPtr<PluginModule>(NULL); // compiler warning silencer
1007 }
1008
1009 IPluginBase* PluginSet::getPlugin(CheckStatusWrapper* status)
1010 {

Callers

nothing calls this directly

Calls 4

GdsClass · 0.85
StatusVectorClass · 0.70
findSymbolMethod · 0.45
addRefMethod · 0.45

Tested by

no test coverage detected