carb::PluginRegistryEntry2

Defined in carb/Types.h

Structs

struct PluginRegistryEntry2

Defines a struct to be filled by a plugin to provide the framework with all information about it. This struct is automatically created and filled by the macro CARB_PLUGIN_IMPL.

Public Members

size_t sizeofThisStruct

Must reflect sizeof(PluginRegistryEntry2); used as a version for this struct.

PluginImplDesc implDesc

Textual information about the plugin (name, desc, etc).

Interface2 *interfaces

Pointer to an array of interfaces implemented by the plugin.

size_t interfaceCount

Number of interfaces in the interfaces array.

struct Interface2

Entry in an array of interfaces implemented by the plugin.

Public Members

size_t sizeofThisStruct

Must reflect sizeof(Interface2); used as a version for this struct.

InterfaceDesc desc

An interface in the plugin.

size_t size

Required size for the interface (must be the maximum size for all supported versions)

size_t align

Required alignment for the interface.

void (*Constructor)(void *p)

Constructor function for this interface within the plugin (auto-generated by CARB_PLUGIN_IMPL).

Called by the framework to construct the interface.

Param p

The buffer (guaranteed to be at least size bytes) to construct the interface into.

void (*Destructor)(void *p)

Destructor function for this interface within the plugin (auto-generated by CARB_PLUGIN_IMPL).

This union member is selected if VersionedConstructor is nullptr.

Called by the framework to destruct the interface before unloading the plugin.

Param p

The buffer previously passed to Constructor that contains the interface.

void (*VersionedDestructor)(Version v, void *p)

Versioned destructor for this interface within the plugin.

This union member is selected if VersionedConstructor is not nullptr.

This function is typically the user-provided function destroyInterface; if that function is not provided no destruction happens.

Param v

The version of the interface, as set in the v parameter for VersionedConstructor before that function returns.

Param p

The interface buffer that was originally passed to VersionedConstructor. Destructor with version

union carb::PluginRegistryEntry2::Interface2::[anonymous] [anonymous]
bool (*VersionedConstructor)(Version *v, void *p)

Versioned constructor function for this interface within the plugin.

This function is typically fillInterface(carb::Version*, void*).

Warning

This function must not fail when desc.version is requested.

Param v

When called, the version requested. Before returning, the function should write the version that is being constructed into p.

Param p

A buffer (guaranteed to be at least size bytes) to construct the interface into.

Retval `true`

if the requested version was available and constructed into p.

Retval `false`

if the requested version is not available.