Corrade/PluginManager/AbstractManager.h file

Class Corrade::PluginManager::AbstractManager, macro CORRADE_PLUGIN_VERSION, CORRADE_PLUGIN_REGISTER()


namespace Corrade
Root namespace.
namespace Corrade::PluginManager
Plugin management.


class Corrade::PluginManager::AbstractManager
Non-templated base for plugin managers.


enum class LoadState: unsigned short { NotFound = 1 << 0, WrongPluginVersion = 1 << 1, WrongInterfaceVersion = 1 << 2, WrongMetadataFile = 1 << 3, UnresolvedDependency = 1 << 4, LoadFailed = 1 << 5, Static = 1 << 6, Loaded = (1 << 7) | LoadState::Static, NotLoaded = 1 << 8, UnloadFailed = 1 << 9, Required = 1 << 10, Used = 1 << 11 }
Plugin load state.


using LoadStates = Containers::EnumSet<LoadState>
Plugin load states.


auto operator<<(Utility::Debug& debug, PluginManager::LoadState value) -> Utility::Debug&
Debug output operator.


Import static plugin.
Plugin version.
#define CORRADE_PLUGIN_REGISTER(name, className, interface)
Register static or dynamic lugin.

Define documentation


Import static plugin.

name Static plugin name (the same as defined with CORRADE_PLUGIN_REGISTER())

If static plugins are compiled into dynamic library or directly into the executable, they should be automatically loaded at startup thanks to CORRADE_AUTOMATIC_INITIALIZER() and CORRADE_AUTOMATIC_FINALIZER() macros.

If static plugins are compiled into static library, they are not automatically loaded at startup, so you need to load them explicitly by calling CORRADE_PLUGIN_IMPORT() at the beginning of main() function. You can also wrap these macro calls into another function (which will then be compiled into dynamic library or main executable) and use CORRADE_AUTOMATIC_INITIALIZER() macro for automatic call:

static int corradeZipFilesystemStaticImport() {
    return 1;
} CORRADE_AUTOMATIC_INITIALIZER(corradeZipFilesystemStaticImport)

#define CORRADE_PLUGIN_REGISTER(name, className, interface)

Register static or dynamic lugin.

name Name of static plugin (equivalent of dynamic plugin filename)
className Plugin class name
interface Interface name (the same as is defined by the pluginInterface() member of given plugin class)

If the plugin is built as static (using CMake command corrade_add_static_plugin()), registers it, so it will be loaded automatically when PluginManager instance with corresponding interface is created. When building as static plugin, CORRADE_STATIC_PLUGIN preprocessor directive is defined.

If the plugin is built as dynamic (using CMake command corrade_add_plugin()), registers it, so it can be dynamically loaded via Corrade::PluginManager::Manager by supplying a name of the plugin. When building as dynamic plugin, CORRADE_DYNAMIC_PLUGIN preprocessor directive is defined.

If the plugin is built as dynamic or static library or executable (not as plugin, using e.g. CMake command add_library() / add_executable()), this macro won't do anything to prevent linker issues when linking more plugins together. No plugin-related preprocessor directive is defined.

See Plugin management for more information about plugin compilation.