Helper that loads a shared library and holds its POSIX handle.
More...
#include <gdl.h>
|
| | DynamicLib ()=default |
| | Default constructor (does not load anything).
|
| | DynamicLib (std::shared_ptr< GLogger > logger, std::string path) |
| | Construct and attempt to load a dynamic library.
|
| | ~DynamicLib () |
| | Destructor closes the library handle (if loaded).
|
This structure centralizes:
- file discovery (try user path, then GEMC install lib/, then build/ for test runs),
- opening the library using
dlopen, and
- closing the library using
dlclose in the destructor.
Search strategy
Given a library name or path:
- Try the provided value as-is.
- If not found, try ${GEMC_ROOT}/lib/<name>.
- If still not found, try ${GEMC_ROOT}/build/<name> (useful for Meson tests in the build tree).
Error reporting
Errors are reported via the configured GLogger instance using:
Definition at line 55 of file gdl.h.
◆ DynamicLib() [1/2]
| DynamicLib::DynamicLib |
( |
| ) |
|
|
default |
◆ DynamicLib() [2/2]
| DynamicLib::DynamicLib |
( |
std::shared_ptr< GLogger > | logger, |
|
|
std::string | path ) |
|
inline |
- Parameters
-
| logger | Logger used for messages and errors. |
| path | Library filename or path (e.g., myplugin.gplugin). |
The constructor attempts multiple locations (see class description) and, if found, opens the library via load_lib().
Definition at line 87 of file gdl.h.
◆ ~DynamicLib()
| DynamicLib::~DynamicLib |
( |
| ) |
|
|
inline |
- Note
dlclose is called only if handle is not null.
Definition at line 162 of file gdl.h.
◆ handle
This is the value returned by dlopen and is later consumed by dlsym.
Definition at line 155 of file gdl.h.
The documentation for this struct was generated from the following file: