Plugin Loader

Plugin Loader — Abstract class for loading plugins

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── GPluginLoader

Description

GPluginLoader defines the base behavior for loaders of all languages.

Functions

gplugin_loader_get_supported_extensions ()

GSList *
gplugin_loader_get_supported_extensions
                               (GPluginLoader *loader);

Returns a GSList of strings containing the extensions that the loader supports. Each extension should not include the dot. For example: so, dll, py, etc.

Parameters

loader

The GPluginLoader instance.

 

Returns

A GSList of extensions that the loader supports.

[element-type utf8][transfer container]


gplugin_loader_query_plugin ()

GPluginPlugin *
gplugin_loader_query_plugin (GPluginLoader *loader,
                             const gchar *filename,
                             GError **error);

This function is called by the plugin manager to ask loader to query filename and determine if it's a usable plugin.

Parameters

loader

The GPluginLoader instance performing the query.

 

filename

The filename to query.

 

error

The return location for a GError, or NULL.

[nullable]

Returns

A GPluginPlugin instance or NULL on failure.

[transfer full]


gplugin_loader_load_plugin ()

gboolean
gplugin_loader_load_plugin (GPluginLoader *loader,
                            GPluginPlugin *plugin,
                            GError **error);

This function is called by the plugin manager to ask loader to load plugin .

Parameters

loader

The GPluginLoader instance performing the load.

 

plugin

The GPluginPlugin instance to load.

 

error

The return location for a GError, or NULL.

[nullable]

Returns

TRUE if plugin was loaded successfully, FALSE otherwise.


gplugin_loader_unload_plugin ()

gboolean
gplugin_loader_unload_plugin (GPluginLoader *loader,
                              GPluginPlugin *plugin,
                              GError **error);

This function is called by the plugin manager to ask loader to unload plugin .

Parameters

loader

The GPluginLoader instance performing the unload.

 

plugin

The GPluginPlugin instance to unload.

 

error

The return location for a GError, or NULL.

[nullable]

Returns

TRUE if plugin was unloaded successfully, FALSE otherwise.

Types and Values

GPLUGIN_TYPE_LOADER

#define GPLUGIN_TYPE_LOADER (gplugin_loader_get_type())

The standard _get_type macro for GPluginLoader.


struct GPluginLoaderClass

struct GPluginLoaderClass {
	GSList *(*supported_extensions)(GPluginLoader *loader);

	GPluginPlugin *(
		*query)(GPluginLoader *loader, const gchar *filename, GError **error);

	gboolean (
		*load)(GPluginLoader *loader, GPluginPlugin *plugin, GError **error);
	gboolean (
		*unload)(GPluginLoader *loader, GPluginPlugin *plugin, GError **error);
};

GPluginLoaderClass defines the behavior for loading plugins.

Members

supported_extensions ()

The supported_extensions vfunc returns a GList of file extensions that this loader supports without the leading dot. For example: 'so', 'dll', 'py', etc.

 

query ()

The query vfunc is called when the plugin manager needs to query a plugin that has a file extension from supported_extensions .

 

load ()

The load vfunc is called when the plugin manager wants to load a plugin that was previously queried by this loader.

 

unload ()

The unload vfunc is called when the plugin manager wants to unload a previously loaded plugin from this loader.

 

GPluginLoader

typedef struct _GPluginLoader GPluginLoader;

An abstract class that should not be accessed directly.