![]() |
![]() |
Public Member Functions | |
Module (const std::string& file_name, ModuleFlags flags=ModuleFlags(0)) | |
Opens a module. | |
virtual | ~Module () |
Close a module. | |
operator bool () const | |
Check whether the module was found. | |
void | make_resident () |
Ensures that a module will never be unloaded. | |
bool | get_symbol (const std::string& symbol_name, void*& symbol) const |
Gets a symbol pointer from the module. | |
std::string | get_name () const |
Get the name of the module. | |
GModule* | gobj () |
const GModule* | gobj () const |
Static Public Member Functions | |
bool | get_supported () |
Checks if modules are supported on the current platform. | |
std::string | get_last_error () |
Gets a string describing the last module error. | |
std::string | build_path (const std::string& directory, const std::string& module_name) |
A portable way to build the filename of a module. | |
Protected Attributes | |
GModule* | gobject_ |
The current implementation supports all systems that provide an implementation of dlopen() (e.g. Linux/Sun), as well as HP-UX via its shl_load() mechanism, and Windows platforms via DLLs.
|
Opens a module. First of all it tries to open file_name as a module. If that fails and file_name has the ".la"-suffix (and is a libtool archive) it tries to open the corresponding module. If that fails and it doesn't have the proper module suffix for the platform (G_MODULE_SUFFIX), this suffix will be appended and the corresponding module will be opended. If that fails and file_name doesn't have the ".la"-suffix, this suffix is appended and it tries to open the corresponding module. Use operator bool() to see whether the operation succeeded. For instance,
|
|
Close a module.
The module will be removed from memory, unless |
|
A portable way to build the filename of a module. The platform-specific prefix and suffix are added to the filename, if needed, and the result is added to the directory, using the correct separator character. The directory should specify the directory where the module can be found. It can be an empty string to indicate that the module is in a standard platform-specific directory, though this is not recommended since the wrong module may be found.
For example, calling
|
|
Gets a string describing the last module error.
|
|
Get the name of the module.
|
|
Checks if modules are supported on the current platform.
|
|
Gets a symbol pointer from the module.
|
|
|
|
|
|
Ensures that a module will never be unloaded. Any calls to the Glib::Module destructor will not unload the module. |
|
Check whether the module was found.
|
|
|