Dynamic Loading of Modules These functions provide a portable way to dynamically load object files (commonly known as 'plug-ins').
More...
Dynamic Loading of Modules These functions provide a portable way to dynamically load object files (commonly known as 'plug-ins').
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.
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 build_path()
on a Linux system with a directory of /lib
and a module_name of "mylibrary" will return /lib/libmylibrary.so
. On a Windows system, using \Windows
as the directory it will return \Windows\mylibrary.dll
.
- Parameters
-
directory | The directory the module is in |
module_name | The name of the module |
- Returns
- The system-specific filename of the module 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 nullptr
or 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 g_module_build_path() on a Linux system with a directory of /lib
and a module_name of "mylibrary" will return /lib/libmylibrary.so
. On a Windows system, using \\Windows
as the directory it will return \\Windows\\mylibrary.dll
.
- Parameters
-
directory | The directory where the module is. This can be nullptr or the empty string to indicate that the standard platform-specific directories will be used, though that is not recommended. |
module_name | The name of the module. |
- Returns
- The complete path of the module, including the standard library prefix and suffix. This should be freed when no longer needed.