The Plug-in System

Defines

FNPLUGINSTATUS_DEFINED
FNPLUGINHOST_DEFINED
FNPLUGIN_DEFINED

Typedefs

typedef enum FnPluginStatus FnPluginStatus

The return status of some of the Plug-in System functions.

typedef FnPluginStatus FnPlugStatus
typedef struct FnPluginHost FnPluginHost

The basic host information that will be provided to a plug-in by setHost().

typedef struct FnPlugin FnPlugin

The basic plug-in information that must be returned from a call to getPlugins().

typedef FnPlugin*(* FnGetPluginsFunc)(unsigned int *numPlugins)

Returns a list of plug-ins provided by a plug-in library.

 FnPlugin *getPlugins(unsigned int *numPlugins); 

This is the only externally-visible function that must be implemented by every plug-in library.

Return
A pointer to an array of plug-in structures, or NULL if none are supported
Parameters
  • numPlugins -

    Write the number of plug-ins provided by the library here. The pointer will not be NULL.

Enums

enum FnPluginStatus

The return status of some of the Plug-in System functions.

Values:

FnPluginStatusOK = 0
FnPluginStatusError = -1
struct FnPluginHost
#include <FnPluginSystem.h>

The basic host information that will be provided to a plug-in by setHost().

Public Members

const void*(* FnPluginHost::getSuite)(const char *apiName, unsigned int apiVersion)

Returns a pointer to the host’s function suite for the given API.

Return
A pointer to the host’s function suite for the given API if successful, or NULL otherwise.
Parameters
  • apiName -

    The name of the API that the host implements

  • apiVersion -

    The integer version of the API that the host implements

const char *name

The name of the host application.

const char *versionStr

A string description of the application version number (e.g. “1.4v1”)

unsigned int versionInt

An integer version number for easy comparison (e.g., “1.2” could be 12 or 102)

struct FnPlugin
#include <FnPluginSystem.h>

The basic plug-in information that must be returned from a call to getPlugins().

Public Members

const char *name

A descriptive name for the plug-in.

const char *apiName

The string name of the API supported by this plug-in.

unsigned int apiVersion

The integer version of the API supported by this plug-in.

unsigned int pluginVersionMajor

The major version of a plug-in changes when a new incompatible version is released.

unsigned int pluginVersionMinor

The minor version of a plug-in changes on small, but compatible, updates.

FnPluginStatus(* FnPlugin::setHost)(FnPluginHost *host)

The host will call this on the plug-in to provide its details and check for acceptance.

Return
FnPluginStatusOK if the plug-in accepts the host, or FnPluginStatusError if not
Parameters
  • host -

    Basic information about the host, for identification and access to the host function suite

const void *(*getSuite)()

The plug-in must implement this to return its suite of functions that implements the API it supports.

Return
A pointer to a suite of functions in a structure, according to the API

void (*flush)()

The host will call this to clean up any plug-in information before unloading the library.