Plugin Loader Interface

Plugin Loader Interface — interface for loading plugins

Functions

Types and Values

Object Hierarchy

    GObject
    ╰── GPluginLoader
        ╰── GPluginNativeLoader

Description

A PluginLoader has to implement the interface described here for GPlugin to be able to use it to load plugins.

Functions

gplugin_loader_class_get_supported_extensions ()

GSList *
gplugin_loader_class_get_supported_extensions
                               (GPluginLoaderClass *klass);

Returns a GSList of string for which extensions the loader supports.

Parameters

klass

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 a loader to query the given file and determine if it's a usable plugin.

Parameters

loader

GPluginLoader instance performing the query

 

filename

filename to query

 

error

return location for a GError, or NULL

 

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 a loader to load the given plugin.

Parameters

loader

GPluginLoader instance performing the load

 

plugin

GPluginPlugin instance to load

 

error

return location for a GError, or NULL

 

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 a loader to unload the given plugin.

Parameters

loader

GPluginLoader instance performing the unload

 

plugin

GPluginPlugin instance to unload

 

error

return location for a GError, or NULL

 

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)(GPluginLoaderClass *klass);

	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);
};

GPluginLoader class 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 data type that should not be accessed directly.