diff --git a/src/jrd/plugin_manager.cpp b/src/jrd/plugin_manager.cpp index 27ff0b7c9e..deedcedee9 100644 --- a/src/jrd/plugin_manager.cpp +++ b/src/jrd/plugin_manager.cpp @@ -295,21 +295,18 @@ void PluginManager::PluginModule::unload_module() // Code that handles loading the generic firebird/plugin directory -static const char *ENGINE_PLUGIN_DIR = "plugins"; -static PluginManager enginePluginManager; -static char enginePluginsLoaded = 0; +const char *PluginManager::ENGINE_PLUGIN_DIR = "plugins"; + #ifndef DARWIN -static char *ENGINE_PLUGIN_REGISTRATION_ENTRYPOINT = "register_plugin"; +const char *PluginManager::ENGINE_PLUGIN_REGISTRATION_ENTRYPOINT = "register_plugin"; #else -static char *ENGINE_PLUGIN_REGISTRATION_ENTRYPOINT = "_register_plugin"; +const char *PluginManager::ENGINE_PLUGIN_REGISTRATION_ENTRYPOINT = "_register_plugin"; #endif -typedef void (*engineRegistrationFuncType)(PluginManager::Plugin*); void PluginManager::load_engine_plugins() { - if (enginePluginsLoaded) - return; - + PluginManager& enginePluginManager = getEnginePluginManager(); + enginePluginManager.addSearchPath(ENGINE_PLUGIN_DIR); enginePluginManager.loadAllPlugins(); @@ -325,3 +322,9 @@ void PluginManager::load_engine_plugins() (*regFunc)(&p); } } + +PluginManager& PluginManager::getEnginePluginManager() +{ + static PluginManager manager; + return manager; +} diff --git a/src/jrd/plugin_manager.h b/src/jrd/plugin_manager.h index c7bff9249c..8b8c7c6177 100644 --- a/src/jrd/plugin_manager.h +++ b/src/jrd/plugin_manager.h @@ -48,6 +48,9 @@ **/ class PluginManager { + static const char *ENGINE_PLUGIN_DIR; + static const char *ENGINE_PLUGIN_REGISTRATION_ENTRYPOINT; + public: static void load_engine_plugins(); @@ -199,8 +202,11 @@ public: /// is the set of all plugins known to the PluginManager. This includes all plugins /// found with the loadAllPluings and findPlugin functions. iterator begin() { return iterator(moduleList); } + + static PluginManager& getEnginePluginManager(); private: + typedef void (*engineRegistrationFuncType)(Plugin*); typedef std::pair Path; Module *moduleList; Firebird::list searchPaths;