Manage code library files. More...
Public Member Functions | |
CodeLibrary () noexcept | |
Initialize variables. | |
~CodeLibrary () noexcept | |
Release variables. | |
eError | init (const char *pFilename) noexcept |
Load in a shared library. | |
void | shutdown (void) noexcept |
Release a shared library. | |
void * | get_function (const char *pFunctionName) noexcept |
Grab a function pointer from a shared library. | |
uint_t | is_initialized (void) const noexcept |
Has a library been loaded? | |
Private Member Functions | |
CodeLibrary (const CodeLibrary &)=delete | |
CodeLibrary & | operator= (const CodeLibrary &)=delete |
CodeLibrary (CodeLibrary &&)=delete | |
CodeLibrary & | operator= (CodeLibrary &&)=delete |
Private Attributes | |
void * | m_pLibInstance |
Instance of the code library. | |
Manage code library files.
Loading a DLL, .so or any other type of shared library is managed with this generic class. Initialize it with a call to init() and then call get_function() to extract each and every pointer to the code or data contained within.
If this class is shut down by the shutdown(void) call, all of the pointers will become invalid and should never be used again.
|
privatedelete |
|
privatedelete |
|
inlinenoexcept |
Initialize variables.
On creation, variables are initialized but no attempt is made to load in a shared library. The shared library is loaded only with a call to init()
|
noexcept |
Release variables.
On disposal, if a share library was loaded, it will be released and all function pointers will be invalid.
|
noexcept |
Grab a function pointer from a shared library.
Search the loaded library for a specific function and if found, return the pointer to use to call it.
pFunctionName | Pointer to a "C" string of the function's name. |
|
noexcept |
Load in a shared library.
If the filename has any colons in it, it's assumed to be a full pathname and the library is directly loaded. If the library name has no colons, it's assumed to be a system code library and the system path(s) are searched until it is found.
pFilename | Pointer to a UTF-8 encoded pathname to the library |
|
inlinenoexcept |
|
privatedelete |
|
privatedelete |
|
noexcept |
Release a shared library.
If a library was loaded, release it back to the operating system.
|
private |
Instance of the code library.