Home -> PlatformBindings -> GetCobaltAPIVersion
Declaration
extern "C" void GetCobaltAPIVersion(unsigned int& major, unsigned int& minor, unsigned int& patch);Description
The GetCobaltAPIVersion function is exported by renderer plugin libraries. It reports the Cobalt Renderer API version that the plugin was built against.
Plugin loaders should resolve and call this function before calling GetRendererPlugin. This allows the loader to reject libraries built against an incompatible Cobalt Renderer API before passing SDK interface objects across the plugin boundary.
The version values should match the COBALT_RENDERER_API_VERSION_MAJOR, COBALT_RENDERER_API_VERSION_MINOR, and COBALT_RENDERER_API_VERSION_PATCH macros from CobaltVersionInfo.h. The SDK plugin enumerator currently requires the major and minor values to match the consuming application. The patch value is reported for diagnostics and does not affect compatibility.
Usage
using GetCobaltAPIVersionFunctionType = void(unsigned int& major, unsigned int& minor, unsigned int& patch);
auto getCobaltAPIVersion = reinterpret_cast<GetCobaltAPIVersionFunctionType*>(resolvedSymbol);
unsigned int pluginMajor = 0;
unsigned int pluginMinor = 0;
unsigned int pluginPatch = 0;
getCobaltAPIVersion(pluginMajor, pluginMinor, pluginPatch);
if ((pluginMajor != COBALT_RENDERER_API_VERSION_MAJOR) || (pluginMinor != COBALT_RENDERER_API_VERSION_MINOR))
{
// Reject the plugin before calling GetRendererInfo
}