CARB_PLUGIN_IMPL_DEPS

Defined in carb/PluginUtils.h

CARB_PLUGIN_IMPL_DEPS(...)

Macros to declare a plugin implementation dependencies.

If a plugin lists an interface “A” as dependency it is guaranteed that carb::Framework::acquireInterface<A>() call will return it, otherwise it can return nullptr. The Framework checks and resolves all dependencies before loading the plugin. If the dependency cannot be loaded (i.e. no plugin satisfies the interface, or a circular load is discovered) then the plugin will fail to load and nullptr will be returned from the carb::Framework::acquireInterface() function.

Note

Circular dependencies can exist as long as they are not stated in the CARB_PLUGIN_IMPL_DEPS() macros. For instance, assume plugins Alpha, Beta, and Gamma. Alpha is dependent on Beta; Beta is dependent on Gamma. Gamma is dependent on Alpha, but cannot list Alpha in its CARB_PLUGIN_IMPL_DEPS() macro, nor attempt to acquire and use it in Gamma’s carbOnPluginStartup() function. At a later point from within Gamma, the desired interface from Alpha may be acquired and used. However, in terms of unload order, Alpha will be unloaded first, followed by Beta and finally Gamma. In this case the Gamma carbOnPluginShutdown() function must account for the fact that Alpha will already be unloaded.

Parameters
  • ... – One or more interface types (e.g. carb::settings::ISettings) to list as dependencies for this plugin.