CARB_PLUGIN_IMPL

Defined in carb/PluginUtils.h

CARB_PLUGIN_IMPL(impl, ...)

Main macro to declare a plugin implementation where multiple interface versions are not required.

Authors of Carbonite plugins must use this macro in exactly one compilation unit for their plugin to generate code expected by the Carbonite framework.

In particular, this macro:

  • Defines global variables, such as g_carbFramework.

  • Registers a default logging channel with omni::log::ILog.

  • Adds boiler-plate code for Omniverse Native Interfaces interop.

  • Adds boiler-plate code for plugin startup, shutdown, and registration. (See Framework Overview for more information).

This macro must be used in the global namespace. A carb::PluginImplDesc must be provided as well as all interfaces exported by this plugin. Each interface must be declared with CARB_PLUGIN_INTERFACE. There must also exist a fillInterface(InterfaceType&) function for each interface type that is exported by this plugin. A trailing semicolon is optional.

Example:

// Plugin Implementation Descriptor
const carb::PluginImplDesc kPluginImpl{ "carb.windowing-glfw.plugin", "Windowing (glfw).", "NVIDIA",
                                         carb::PluginHotReload::eDisabled, "dev" };

// Generate boilerplate code
CARB_PLUGIN_IMPL(kPluginImpl, carb::windowing::IWindowing, carb::windowing::IGLContext)

// Construct the carb::windowing::IWindowing interface
void fillInterface(carb::windowing::IWindowing& iface) { /* ... */ }

// Construct the carb::windowing::IGLContext interface
void fillInterface(carb::windowing::IGLContext& iface) { /* ... */ }

See Framework Overview and Carbonite Interfaces for more information on creating Carbonite plugins.

Note

Carbonite plugins can provide multiple versions of an interface to remain backwards compatible with apps and modules that are built against earlier versions of plugins. In order to do this, see CARB_PLUGIN_IMPL_EX.

Parameters
  • impl – The carb::PluginImplDesc constant to be used as plugin description.

  • ... – One or more interface types to be implemented by the plugin. An interface is a struct or class with a use of CARB_PLUGIN_INTERFACE() inside it. These interface types are constructed by a global function fillInterface(InterfaceType&) that must exist in the plugin. See fillInterface(InterfaceType&) for more information about interface construction and destruction.