Entry
Points
There are 3 primary entry points into the plugin.
These are the 3 core functions that the plugin must implement. The
first 2 are the main functions used by the plugin, these are defined as:
BZF_PLUGIN_CALL int bz_Load (
const char* command );
BZF_PLUGIN_CALL int bz_Unload (
void );
bz_Load is called when the plugin is first
initialized. This is when the plugin should register any event
handlers that it wishes to use and initialize any "one time" startup
data.
bz_Unload is called when a plugin is no longer
needed and will be shut down. This is most commonly called when bzfs is
quiting. A plugin should do any clean up in this callback.
The last function is defined as:
BZF_PLUGIN_CALL int bz_GetVersion (
void );
bz_GetVersion is called buy bzfs before any other
functions are called. The function should return the version of the API
that it is written for. This is to prevent bzfs from attempting to load
incompatible plugins.
There is a C++ MACRO defined to ease the
implementation of this function. All a plugin must do is put the macro;
BZ_GET_PLUGIN_VERSION
somewhere in its sources, and then export the
function. This will automatically return the API version of the current
API you are using. See the sample plugins for examples. These will be
the only 3 functions called by bzfs for non-event actions.
All functions should be preceded with the
BZF_PLUGIN_CALL macro. This macro will tell your compiler to export
these functions so bzfs can call them.
|