Class DynamicLibraryLoader
Defined in File DynamicLibraryLoader.h
Class Documentation
-
class DynamicLibraryLoader
Loads dynamic libraries and fetches symbols.
Public Functions
-
DynamicLibraryLoader(const std::string &path, int flags = RTLD_NOW)
Loads the given library with the given flags.
- Parameters
path – Path to the dynamic library to load.
flags – Flags of dlopen.
- Throws
std::runtime_error – with the result of dlerror() if the library could not be loaded.
-
~DynamicLibraryLoader()
Closes the loaded dynamic library
-
void *operator()(const std::string &symbol)
Fetches the given symbol in the loaded dynamic library.
- Parameters
symbol – Symbol to fetch.
- Throws
std::runtime_error – with the result of dlerror() if the symbol could not be found in the loaded dynamic library.
- Returns
The result of dlsym if succeeded.
-
DynamicLibraryLoader(const std::string &path, int flags = RTLD_NOW)