C-Pluff C API  0.1.4
Functions
Plug-in context initialization

These functions are used to manage plug-in contexts from the main program perspective. More...

Functions

CP_IMPORT cp_context_tcp_create_context (cp_status_t *status)
 Creates a new plug-in context which can be used as a container for plug-ins. More...
 
CP_IMPORT void cp_destroy_context (cp_context_t *ctx)
 Destroys the specified plug-in context and releases the associated resources. More...
 
CP_IMPORT cp_status_t cp_register_pcollection (cp_context_t *ctx, const char *dir)
 Registers a plug-in collection with a plug-in context. More...
 
CP_IMPORT void cp_unregister_pcollection (cp_context_t *ctx, const char *dir)
 Unregisters a previously registered plug-in collection from a plug-in context. More...
 
CP_IMPORT void cp_unregister_pcollections (cp_context_t *ctx)
 Unregisters all plug-in collections from a plug-in context. More...
 

Detailed Description

These functions are used to manage plug-in contexts from the main program perspective.

They are not intended to be used by a plug-in runtime. From the main program perspective a plug-in context is a container for installed plug-ins. There can be several plug-in context instances if there are several independent sets of plug-ins. However, different plug-in contexts are not very isolated from each other in practice because the global symbols exported by a plug-in runtime in one context are visible to all plug-ins in all context instances.

Function Documentation

CP_IMPORT cp_context_t* cp_create_context ( cp_status_t status)

Creates a new plug-in context which can be used as a container for plug-ins.

Plug-ins are loaded and installed into a specific context. The main program may have more than one plug-in context but the plug-ins that interact with each other should be placed in the same context. The resources associated with the context are released by calling cp_destroy_context when the context is not needed anymore. Remaining contexts are automatically destroyed when the plug-in framework is destroyed.

Parameters
statuspointer to the location where status code is to be stored, or NULL
Returns
the newly created plugin context, or NULL on failure
CP_IMPORT void cp_destroy_context ( cp_context_t ctx)

Destroys the specified plug-in context and releases the associated resources.

Stops and uninstalls all plug-ins in the context. The context must not be accessed after calling this function.

Parameters
ctxthe context to be destroyed
CP_IMPORT cp_status_t cp_register_pcollection ( cp_context_t ctx,
const char *  dir 
)

Registers a plug-in collection with a plug-in context.

A plug-in collection is a directory that has plug-ins as its immediate subdirectories. The plug-in context will scan the directory when cp_scan_plugins is called. Returns CP_OK if the directory has already been registered. A plug-in collection can be unregistered using cp_unregister_pcollection or cp_unregister_pcollections.

Parameters
ctxthe plug-in context
dirthe directory
Returns
CP_OK (zero) on success or CP_ERR_RESOURCE if insufficient memory
CP_IMPORT void cp_unregister_pcollection ( cp_context_t ctx,
const char *  dir 
)

Unregisters a previously registered plug-in collection from a plug-in context.

Plug-ins already loaded from the collection are not affected. Does nothing if the directory has not been registered. Plug-in collections can be registered using cp_register_pcollection.

Parameters
ctxthe plug-in context
dirthe previously registered directory
CP_IMPORT void cp_unregister_pcollections ( cp_context_t ctx)

Unregisters all plug-in collections from a plug-in context.

Plug-ins already loaded are not affected. Plug-in collections can be registered using cp_register_pcollection.

Parameters
ctxthe plug-in context

Generated on Fri Jan 1 2016 23:17:02 for C-Pluff C API by doxygen 1.8.6