Table Of Contents

Previous topic

Plug-in Manager

Next topic

Plug-in Object

Plug-in Definition

Definitions of plug-in functions and symbols. A plug-in must define at least one externally visible symbol, named s_plugin_init. This symbol must be a function of the s_plugin_init_fp type. The Plug-in Manager will look up this symbol and call this function after the plug-in has loaded. From this function the Plug-in Manager will get the s_plugin_params defined by the plug-in. When the plug-in is unloaded, the Plug-in Manager will call the s_plugin_exit_fp to free up any resources used by the plug-in.

Definitions

typedef const s_plugin_params *(*s_plugin_init_fp)(s_erc *error)

Plug-in start-up function.

This is the first function called when a plug-in is loaded. It must always be called s_plugin_init, as this is the symbol name that is looked for. The function must return a s_plugin_params structure that must be filled in by the plug-in itself. The plug-in can check for version compatibility in this function with s_lib_version_ok, or can call s_speect_version to get the Speect Engine version and do version compatibility testing itself.

Parameters:
  • error

    Error code.

Return:

Pointer to the parameters that the plug-in must set, may be statically allocated.

Note:

This function need not be re-entrant, and therefore not thread-safe.

typedef void(*s_plugin_reg_fp)(s_erc *error)

Plug-in register function.

This is called after the plug-in is initialized (s_plugin_init_fp) and has passed the version compatibility handshaking, s_version_ok (internal function) and s_lib_version_ok. Plug-ins register their classes here, and can load any other required plug-ins, and/or do some initialization.

Parameters:
  • error

    Error code.

Note:

This function need not be re-entrant, and therefore not thread-safe.

typedef void(*s_plugin_exit_fp)(s_erc *error)

Plug-in exit function.

This function is called just before the dynamic shared object that this plug-in belongs to is unloaded. Any acquired resources must be released in this function.

Parameters:
  • error

    Error code.

Note:

This function need not be re-entrant, and therefore not thread-safe.

Plug-in parameters

typedef struct s_plugin_params

The plug-in parameters structure.

This structure is returned from a plug-in on initialization.

Public Members
const char *name

The name of the plug-in.

const char *description

A short description of the plug-in.

const s_version version

Plug-in version.

const s_version s_abi

Speect ABI version (which plug-in was compiled with)

const s_plugin_reg_fp reg_func

Plug-in register function pointer.

const s_plugin_exit_fp at_exit

Plug-in exit function pointer.