GRUTinizer
|
Loads a Shared Object library. More...
#include <DynamicLibrary.h>
Public Member Functions | |
DynamicLibrary (std::string libname, bool unique_name=false) | |
Loads a shared object library. | |
~DynamicLibrary () | |
Destructs the shared object library. | |
DynamicLibrary (DynamicLibrary &&other) | |
Moves constructor. | |
DynamicLibrary & | operator= (DynamicLibrary &&other) |
Move assignment operator. | |
DynamicLibrary (const DynamicLibrary &) | |
DynamicLibrary & | operator= (const DynamicLibrary &) |
void * | GetSymbol (const char *symbol) |
Extracts a symbol from the shared library. |
Private Member Functions | |
void | swap (DynamicLibrary &other) |
Private Attributes | |
void * | library |
Loads a Shared Object library.
The be moved, but not copied. When the object is destroyed, the library is closed. The caller is responsible for keeping the object alive while symbols from the object are being used.
DynamicLibrary::DynamicLibrary | ( | std::string | libname, |
bool | unique_name = false |
||
) |
Loads a shared object library.
libname | Path to the library to be loaded. |
unique_name | Generates a uniquely named symlink to the file, which is then opened. |
dlopen/dlclose maintains a reference count, caching shared objects in case a library is loaded multiple times. However, if a library is going to change as the program runs, then this caching works against us. In this case, "unique_name" should be set to true.
DynamicLibrary::~DynamicLibrary | ( | ) |
Destructs the shared object library.
Closes the shared object library. All symbols from the shared object library become invalid. The caller is responsible for keeping the DynamicLibrary alive, while symbols from the library are in use.
DynamicLibrary::DynamicLibrary | ( | DynamicLibrary && | other | ) |
Moves constructor.
DynamicLibrary::DynamicLibrary | ( | const DynamicLibrary & | ) |
void * DynamicLibrary::GetSymbol | ( | const char * | symbol | ) |
Extracts a symbol from the shared library.
DynamicLibrary & DynamicLibrary::operator= | ( | DynamicLibrary && | other | ) |
Move assignment operator.
DynamicLibrary& DynamicLibrary::operator= | ( | const DynamicLibrary & | ) |
|
private |
|
private |