MRDOCS_PLUGIN_EXPORT
The attribute that makes a plugin's entry points visible.
Synopsis
Declared in <mrdocs/Plugin.hpp>
#define MRDOCS_PLUGIN_EXPORT
Description
It expands to __declspec(dllexport) on MSVC and to attributevisibility("default") elsewhere. MrDocs looks the entry points up by name in the loaded library, so they have to be exported from it. The plugin recipe compiles a plugin with hidden visibility, and Windows exports nothing that lacks the attribute, so an entry point without it is invisible to the loader.
MRDOCS_PLUGIN_MAIN applies it to the functions it defines. A plugin that does not use that macro puts it before the return type of each of the three extern "C" entry points, mrdocs_plugin_build_id, mrdocs_plugin_stdlib_tag and mrdocs_plugin_main:
extern "C" MRDOCS_PLUGIN_EXPORT char const*
mrdocs_plugin_build_id()
{
return MRDOCS_PLUGIN_BUILD_ID;
}
extern "C" MRDOCS_PLUGIN_EXPORT char const*
mrdocs_plugin_stdlib_tag()
{
return MRDOCS_PLUGIN_STDLIB_TAG;
}
extern "C" MRDOCS_PLUGIN_EXPORT bool
mrdocs_plugin_main(mrdocs::PluginContext& plugin, mrdocs::Error* error)
{
// Register generators and transforms, and fill in *error on failure.
return true;
}
The attribute is for the entry points only. The other functions of a plugin stay hidden on purpose, and MRDOCS_DECL marks the MrDocs API, not plugin code.
Without it the library loads but the loader cannot find the entry points, and the run stops with `the plugin "<name>" does not export mrdocs_plugin_build_id`, the first of the three it looks for.
Created with MrDocs