15 #define LIB_HANDLE HMODULE
16 #define LOAD_LIB(path) LoadLibraryA(path)
17 #define GET_FUNC(handle,name) GetProcAddress(handle, name)
18 #define CLOSE_LIB(handle) FreeLibrary(static_cast<HMODULE>(handle))
21 #define LIB_HANDLE void*
22 #define LOAD_LIB(path) dlopen(path, RTLD_NOW | RTLD_GLOBAL)
23 #define GET_FUNC(handle,name) dlsym(handle, name)
24 #define CLOSE_LIB(handle) dlclose(handle)
27namespace fs = std::filesystem;
86 std::vector<PluginData> _plugins;
88 std::vector<std::string> getPluginFiles(
const std::string& directory);
89 std::vector<std::string> getFilesInDirectory(
const std::string& directory,
90 const std::string& extension =
"");
177 void doUnloadPlugin(
Plugin* plugin);
CRTP base that gives a manager safe deferred-operation support.
Abstract base class for all Malena plugins.
void unloadPlugin(Plugin *plugin)
Unload a plugin and close its shared library.
Plugin * loadPlugin(const std::string &path)
Load a single plugin from a shared library path.
void loadPluginsFromDirectory(const std::string &dir)
Load all plugin libraries found in a directory.
std::vector< Plugin * > getPlugins()
Return all currently loaded plugins.
PluginManager(const std::string &pluginPath="")
Construct a PluginManager with a default plugin search path.
std::vector< PluginInfo > scanPlugins(const std::string &dir)
Probe a directory for plugins without keeping them loaded.