| Anjuta Developers Reference Manual | ||||
|---|---|---|---|---|
#include <libanjuta/anjuta-c-module.h>
AnjutaCModule;
AnjutaCModuleClass;
AnjutaCModule* anjuta_c_module_new (const gchar *path,
const char *name);
gboolean anjuta_c_module_get_last_error (AnjutaCModule *module,
GError **err);
A module is the part of the plugin containing the code. For machine code
compiled from C sources by example, it is a shared library and contained in
a .so file on Linux. GLib provides a portable way to load dynamically such
code with
In GLib you can register a dynamic type which means that you links a GLib
type with a module. When the type is used for the first time the module is
loaded. When the type is not used anymore, the module is unloaded. Most of
the code necessary to do this is already written in GLib
AnjutaCModule is used only by a AnjutaCPluginFactory. It derives from
Anjuta plugin types are not registered before loading the module.
The loading of the module is done explicitly and types are registered just
after in a function included in the plugin. This function is named
anjuta_glue_register_components and has a
After loading a module one or more plugin objects will be created using the name of the plugin type which has just been registered. The module will stay loaded while at least one plugin object is present. If all plugins objects are destroyed the unload function will be called and the module can be unloaded and removed from memory.
It could be useful that some modules stay in memory even if there is no object using it. A typical example is if some plugin code or some code of a library used by a plugin registers a GLib type statically. GLib types can be registered statically at run time but cannot be unregistered later. The code (or rather the data used in the registration) must stay in the memory even if the type is not used. In order to avoid this, you must register every type dynamically. You could have other situations where a module cannot be unloaded. By default, Anjuta plugin modules are not unloaded unless it is explicitly allowed.
AnjutaCModule* anjuta_c_module_new (constgchar *path, constchar *name);
Create a new AnjutaCModule object.
path : |
The full path of the module |
name : |
The name of the module |
| Returns : | a new AnjutaCModule object. |
gboolean anjuta_c_module_get_last_error (AnjutaCModule *module,GError **err);
module : |
|
err : |
|
| Returns : |