## PgmPlugin

PgmPlugin — Various structs and macros used for plugins handling.

## Synopsis

    #include <pgm/pgm.h>

    #define             PGM_PLUGIN_PATH_NAME
    gboolean            (*PgmPluginInitFunc)                (GTypeModule *module);
    gboolean            (*PgmPluginShutdownFunc)            (GTypeModule *module);
    PgmViewport *       (*PgmPluginCreateFunc)              (void);
                        PgmPluginDesc;
    #define             PGM_PLUGIN_DEFINE                   (init,shutdown,create,name,version,description,license,origin,author)

## Description

Various structs and macros used by Pigment for plugins handling.

Last reviewed on 2007-04-12 (0.1.5)

## Details

### PGM_PLUGIN_PATH_NAME

    #define PGM_PLUGIN_PATH_NAME "PGM_PLUGIN_PATH"

The name of the plugin path environment variable name.

### PgmPluginInitFunc ()

    gboolean            (*PgmPluginInitFunc)                (GTypeModule *module);

A plugin should provide a pointer to a function of this type in the PgmPluginDesc struct. This function will be called to initialize the plugin.

`module` : | the GTypeModule to use in the init func to register your types (with `g_type_module_register_type()` or PGM_DEFINE_DYNAMIC_TYPE or PGM_DEFINE_DYNAMIC_TYPE_EXTENDED.
Returns : | `TRUE` if the initialization successes, `FALSE` otherwise.

### PgmPluginShutdownFunc ()

    gboolean            (*PgmPluginShutdownFunc)            (GTypeModule *module);

A plugin should provide a pointer to a function of this type in the PgmPluginDesc struct. This function will be called to shutdown the plugin.

`module` : | the GTypeModule that was passed to the PgmPluginInitFunc function.
Returns : | `TRUE` if the deinitialization successes, `FALSE` otherwise.

### PgmPluginCreateFunc ()

    PgmViewport *       (*PgmPluginCreateFunc)              (void);

A plugin should provide a pointer to a function of this prototype in the `PgmPluginDesc` struct. This function will be called by the user to create the `PgmViewport`.

Returns : | a new PgmViewport.

### PgmPluginDesc

    typedef struct {
      PgmPluginInitFunc      init;
      PgmPluginShutdownFunc  shutdown;
      PgmPluginCreateFunc    create;
      gchar                 *name;
      gchar                 *version;
      gchar                 *description;
      gchar                 *license;
      gchar                 *origin;
      gchar                 *author;
    } PgmPluginDesc;

Pigment Plugin description structure.

PgmPluginInitFunc `init`; | the plugin initialization function pointer.
PgmPluginShutdownFunc `shutdown`; | the plugin shutdown function pointer.
PgmPluginCreateFunc `create`; | the plugin create function pointer (returning a `PgmViewport`).
gchar *`name`; | the plugin name.
gchar *`version`; | the version string of Pigment that plugin was compiled for.
gchar *`description`; | the plugin description.
gchar *`license`; | the plugin license.
gchar *`origin`; | the plugin origin URL.
gchar *`author`; | the plugin author.

### PGM_PLUGIN_DEFINE()

    #define             PGM_PLUGIN_DEFINE(init,shutdown,create,name,version,description,license,origin,author)

Utility macro to create a PgmPluginDesc plugin description structure. This is the entry point for every Pigment plugin and it is highly recommended to use this macro to avoid common mistakes maxking entry point unusable.

`init` : | the plugin initialization function pointer.
`shutdown` : | the plugin shutdown function pointer.
`create` : | the plugin creation function pointer (returning a `PgmViewport`).
`name` : | the plugin name.
`version` : | the version string of Pigment that plugin was compiled for.
`description` : | the plugin description.
`license` : | the plugin license.
`origin` : | the plugin origin URL.
`author` : | the plugin author.