Base class for dynamic loading of shared object libraries.
More...
#include <FFaDynamicLibraryBase.H>
|
bool | load (const std::string &libName, bool silence=false) |
| Loads the library named libName. More...
|
|
bool | unload (const std::string &libName, bool silence=false) |
| Unloads the library named libName. More...
|
|
void | unloadAll () |
| Unloads all libraries and clears the function cache. More...
|
|
bool | areLibsLoaded () const |
| Returns whether dynamics libraries have been loaded or not. More...
|
|
const char * | getLibrary (size_t idx=1) const |
| Returns the file name of the dynamic library, if loaded. More...
|
|
Base class for dynamic loading of shared object libraries.
◆ cache_info
Function pointer with language binding.
◆ LibHandle
Dynamic library handle with associated language binding.
◆ LanguageBinding
Enums defining the supported language bindings.
Enumerator |
---|
Undefined | |
C | |
Fortran | |
◆ FFaDynamicLibraryBase()
FFaDynamicLibraryBase::FFaDynamicLibraryBase |
( |
| ) |
|
|
inlineprotected |
◆ ~FFaDynamicLibraryBase()
virtual FFaDynamicLibraryBase::~FFaDynamicLibraryBase |
( |
| ) |
|
|
inlineprotectedvirtual |
The destructor unloads all dynamically loaded libraries.
◆ areLibsLoaded()
bool FFaDynamicLibraryBase::areLibsLoaded |
( |
| ) |
const |
|
inline |
Returns whether dynamics libraries have been loaded or not.
◆ getAddress()
DLPROC FFaDynamicLibraryBase::getAddress |
( |
const LibHandle & |
lib, |
|
|
const std::string & |
fname |
|
) |
| |
|
staticprivate |
Returns the pointer to a named function.
◆ getLibrary()
const char * FFaDynamicLibraryBase::getLibrary |
( |
size_t |
idx = 1 | ) |
const |
Returns the file name of the dynamic library, if loaded.
◆ getProcAddr() [1/2]
DLPROC FFaDynamicLibraryBase::getProcAddr |
( |
const std::string & |
cName, |
|
|
const std::string & |
fName, |
|
|
LanguageBinding & |
lang, |
|
|
bool |
silence = false |
|
) |
| const |
|
protected |
Returns the function pointer for the named function.
The language binding is set depending on whether the provided cName (C/C++) or fName (Fortran) is found.
◆ getProcAddr() [2/2]
DLPROC FFaDynamicLibraryBase::getProcAddr |
( |
const std::string & |
fName, |
|
|
bool |
silence = false |
|
) |
| const |
|
protected |
Returns the function pointer for the named function.
Does not store the pointer in the cache, so this method should only be used for non-critical functions invoked only a few times.
◆ getProcAddress() [1/2]
DLPROC FFaDynamicLibraryBase::getProcAddress |
( |
const std::string & |
cName, |
|
|
const std::string & |
fName, |
|
|
LanguageBinding & |
lang, |
|
|
size_t |
procID |
|
) |
| const |
|
protected |
Returns the function pointer for the given function.
The pointer is stored in a local cache to speed up repeated calls.
◆ getProcAddress() [2/2]
DLPROC FFaDynamicLibraryBase::getProcAddress |
( |
const std::string & |
fName, |
|
|
size_t |
procID |
|
) |
| const |
|
protected |
Returns the function pointer for the given function.
The pointer is stored in a local cache to speed up repeated calls.
◆ load()
bool FFaDynamicLibraryBase::load |
( |
const std::string & |
libName, |
|
|
bool |
silence = false |
|
) |
| |
Loads the library named libName.
- Returns
- true if OK and false if the library is not available.
◆ unload()
bool FFaDynamicLibraryBase::unload |
( |
const std::string & |
libName, |
|
|
bool |
silence = false |
|
) |
| |
Unloads the library named libName.
- Returns
- true if found and false if the library was not loaded.
◆ unloadAll()
void FFaDynamicLibraryBase::unloadAll |
( |
| ) |
|
Unloads all libraries and clears the function cache.
◆ myLibHandles
std::map<std::string,LibHandle> FFaDynamicLibraryBase::myLibHandles |
|
private |
Dynamic library container.
◆ myProcCache
std::vector<cache_info> FFaDynamicLibraryBase::myProcCache |
|
mutableprivate |
The documentation for this class was generated from the following files: