EthosPluginLoader

## EthosPluginLoader EthosPluginLoader — loading of plugins during runtime |

## Synopsis

    #define             ETHOS_PLUGIN_LOADER_GET_INTERFACE   (obj)
                        EthosPluginLoader;
                        EthosPluginLoaderIface;
    const gchar*        ethos_plugin_loader_get_name        (EthosPluginLoader *plugin_loader);
    void                ethos_plugin_loader_initialize      (EthosPluginLoader *plugin_loader,
                                                             EthosManager *manager);
    void                ethos_plugin_loader_unload          (EthosPluginLoader *plugin_loader);
    EthosPlugin*        ethos_plugin_loader_load            (EthosPluginLoader *plugin_loader,
                                                             EthosPluginInfo *plugin_info,
                                                             GError **error);
    void                ethos_plugin_loader_gc              (EthosPluginLoader *plugin_loader);
    void                ethos_plugin_loader_register_plugin (EthosPluginLoader *plugin_loader,
                                                             EthosPlugin *plugin);

## Object Hierarchy

      GInterface
       +----EthosPluginLoader

## Prerequisites

EthosPluginLoader requires GObject.

## Description

The EthosPluginLoader interface is responsible for loading plugins during runtime. Plugins can specify a plugin-loader that should load them in their plugin desciption file. This is done using the Loader keyword such as follows.

    [Test Plugin]
    Name=Sample
    Loader=python
    Module=sample
    IAge=1

In this example, the EthosPythonLoader will be used to load the plugin. The python loader, like all loaders, requires that the Module keyword is set. In this case, the module is "sample", so the python loader will look for "sample.py" to load the plugin.

## Details

### ETHOS_PLUGIN_LOADER_GET_INTERFACE()

    #define ETHOS_PLUGIN_LOADER_GET_INTERFACE(obj)	(G_TYPE_INSTANCE_GET_INTERFACE((obj), ETHOS_TYPE_PLUGIN_LOADER, EthosPluginLoaderIface))

`obj` : |

### EthosPluginLoader

    typedef struct _EthosPluginLoader EthosPluginLoader;

### EthosPluginLoaderIface

    typedef struct {
    	GObjectClass parent_class;

    	const gchar* (*get_name)        (EthosPluginLoader  *plugin_loader);
    	void         (*initialize)      (EthosPluginLoader  *plugin_loader,
    	                                 EthosManager       *manager);
    	void         (*unload)          (EthosPluginLoader  *plugin_loader);
    	EthosPlugin* (*load)            (EthosPluginLoader  *plugin_loader,
    	                                 EthosPluginInfo    *plugin_info,
    	                                 GError            **error);
    	void         (*gc)              (EthosPluginLoader  *plugin_loader);
    	void         (*register_plugin) (EthosPluginLoader *plugin_loader,
    	                                 EthosPlugin       *plugin);

    	void         (*reserved1)  (void);
    	void         (*reserved2)  (void);
    	void         (*reserved3)  (void);
    	void         (*reserved4)  (void);
    } EthosPluginLoaderIface;

### ethos_plugin_loader_get_name ()

    const gchar*        ethos_plugin_loader_get_name        (EthosPluginLoader *plugin_loader);

Retrieves the name of the plugin loader. The default plugin loader's name is `NULL`.

`plugin_loader` : | An EthosPluginLoader
Returns : | The name of the plugin loader or `NULL`

### ethos_plugin_loader_initialize ()

    void                ethos_plugin_loader_initialize      (EthosPluginLoader *plugin_loader,
                                                             EthosManager *manager);

Initializes the plugin loader.

`plugin_loader` : | An EthosPluginLoader
`manager` : | An EthosManager

### ethos_plugin_loader_unload ()

    void                ethos_plugin_loader_unload          (EthosPluginLoader *plugin_loader);

Unloads the plugin loader and cleans up related resources.

`plugin_loader` : | An EthosPluginLoader

### ethos_plugin_loader_load ()

    EthosPlugin*        ethos_plugin_loader_load            (EthosPluginLoader *plugin_loader,
                                                             EthosPluginInfo *plugin_info,
                                                             GError **error);

Creates an instance of the plugin from the information in the `plugin_info` object.

In case of failure, `error` is set and `NULL` is returned.

`plugin_loader` : | An EthosPluginLoader
`plugin_info` : | An EthosPluginInfo
`error` : | A location for a GError or `NULL`
Returns : | The newly created EthosPlugin instance or `NULL`.

### ethos_plugin_loader_gc ()

    void                ethos_plugin_loader_gc              (EthosPluginLoader *plugin_loader);

Runs the garbage collector for an associated vm for the plugin loader.

`plugin_loader` : | An EthosPluginLoader

### ethos_plugin_loader_register_plugin ()

    void                ethos_plugin_loader_register_plugin (EthosPluginLoader *plugin_loader,
                                                             EthosPlugin *plugin);

For plugin-loaders that do not support creation of GObjectClass's during runtime, this method can be used to instantiate a plugin instance and the plugin-loader will be notified. For example, a JavaScript plugin may create an instance of EthosPlugin and connect signals rather than creating its own child class.

See `ethos_register_runtime_plugin()`.

`plugin_loader` : | An EthosPluginLoader
`plugin` : | An EthosPlugin