cp_plugin_loader_t Struct Reference
Data structures
Collaboration diagram for cp_plugin_loader_t:
[legend]

## Data Fields

void * | data
| An opaque data pointer for this plug-in loader instance. More...
cp_plugin_info_t **(* | scan_plugins )(void *data, cp_context_t *ctx)
| A function called to load plug-in information from the configured plug-in collection. More...
int(* | resolve_files )(void *data, cp_context_t *ctx, cp_plugin_info_t *plugin)
| A function called to ensure that the plug-in runtime code and data is locally available. More...
void(* | release_plugins )(void *data, cp_context_t *ctx, cp_plugin_info_t **plugins)
| A function called to release plug-in information returned by the scan_plugins function. More...

## Detailed Description

A plug-in loader instance. Plug-in loaders are responsible for loading plug-in information from plug-in collections and providing it to the framework. The loader exposes its services to the framework via an instance of this structure which is obtained from a loader-specific constructor function.

Library initialization and plug-in context management functions must not be called from within the service functions stored in this structure.

The framework itself provides a plug-in loader capable of loading plugins from a local plug-in collection (a directory containing plugins). However, applications may provide custom plug-in loaders, for example to load plug-ins from remote plug-in collections.

## Field Documentation

## data

void* data

An opaque data pointer for this plug-in loader instance.

This data pointer is passed on to service functions specified by this structure. The loader-specific constructor initializes it to instance-specific data such as configuration of the plug-in collection.

## scan_plugins

cp_plugin_info_t**(* scan_plugins(void *data, cp_context_t *ctx)

A function called to load plug-in information from the configured plug-in collection.

Loads and returns plug-in descriptors for compatible plug-ins found in the plug-in collection. The returned plug-in information must be loaded using cp_load_plugin_descriptor. This function is called when cp_scan_plugins is called. The data returned by this function is released by calling the release_plugins function when the array is not needed anymore. This function returns NULL on failure.

The runtime code and data of the returned plug-ins does not need to be locally available. The resolve_files function is explicitly called when the runtime code and data is needed. The plug-in path must be initialized into a location that will hold the plug-in code and data after the plug-in has been resolved. In practice this means that the plug-in descriptor must be loaded from a path that will hold plug-in and data after the plug-in has been resolved.

Parameters

  data | plug-in loader data
  ctx | the associatd plug-in context

Returns
  pointer to a NULL-terminated array of plug-in information pointers, or NULL on failure

## resolve_files

int(* resolve_files(void *data, cp_context_t *ctx, cp_plugin_info_t *plugin)

A function called to ensure that the plug-in runtime code and data is locally available.

Makes the runtime code and data of the specified plug-in available at the plug-in path. The specified plug-in has been obtained from a call to scan_plugins. Does nothing if the plug-in runtime data is already locally available. This function may be NULL if plug-ing runtime data is always available after successful scan.

Parameters

  data | plug-in loader data
  ctx | the associated plug-in context
  plugin | plug-in information for the plug-in being resolved

Returns
  non-zero on success or zero on failure

## release_plugins

void(* release_plugins(void *data, cp_context_t *ctx, cp_plugin_info_t **plugins)

A function called to release plug-in information returned by the scan_plugins function.

This function must call cp_release_info on each plug-in information structure and deallocate the pointer array. If this function is NULL, the framework will release plug-in information structures and deallocate the pointer array using free.

Parameters

  data | plug-in loader data
  ctx | the associated plug-in context
  plugins | pointer to a NULL-terminated array of plug-in information pointers obtained from a call to scan_plugins

The documentation for this struct was generated from the following file:

- cpluff.h

Generated on Sun May 3 2020 12:13:55 for C-Pluff C API by 1.8.17