13 #ifndef FFA_DYNAMIC_LIBRARY_BASE_H
14 #define FFA_DYNAMIC_LIBRARY_BASE_H
20 #if defined(win32) || defined(win64)
22 #define WIN32_LEAN_AND_MEAN
48 bool load(
const std::string& libName,
bool silence =
false);
49 bool unload(
const std::string& libName,
bool silence =
false);
66 #if defined(win32) || defined(win64)
67 typedef std::pair<LanguageBinding,HINSTANCE>
LibHandle;
void * DLPROC
Function pointer on UNIX.
Definition: FFaDynamicLibraryBase.H:28
static char * fname[_MAX_DBFIL]
Definition: binaryDB.c:35
Base class for dynamic loading of shared object libraries.
Definition: FFaDynamicLibraryBase.H:37
bool areLibsLoaded() const
Returns whether dynamics libraries have been loaded or not.
Definition: FFaDynamicLibraryBase.H:52
DLPROC getProcAddr(const std::string &fName, bool silence=false) const
Returns the function pointer for the named function.
Definition: FFaDynamicLibraryBase.C:158
bool load(const std::string &libName, bool silence=false)
Loads the library named libName.
Definition: FFaDynamicLibraryBase.C:32
std::map< std::string, LibHandle > myLibHandles
Dynamic library container.
Definition: FFaDynamicLibraryBase.H:75
LanguageBinding
Enums defining the supported language bindings.
Definition: FFaDynamicLibraryBase.H:45
@ Undefined
Definition: FFaDynamicLibraryBase.H:45
@ C
Definition: FFaDynamicLibraryBase.H:45
@ Fortran
Definition: FFaDynamicLibraryBase.H:45
std::vector< cache_info > myProcCache
Function pointer cache.
Definition: FFaDynamicLibraryBase.H:74
void unloadAll()
Unloads all libraries and clears the function cache.
Definition: FFaDynamicLibraryBase.C:109
FFaDynamicLibraryBase()
Default constructor.
Definition: FFaDynamicLibraryBase.H:40
std::pair< LanguageBinding, void * > LibHandle
Dynamic library handle with associated language binding.
Definition: FFaDynamicLibraryBase.H:69
virtual ~FFaDynamicLibraryBase()
The destructor unloads all dynamically loaded libraries.
Definition: FFaDynamicLibraryBase.H:42
bool unload(const std::string &libName, bool silence=false)
Unloads the library named libName.
Definition: FFaDynamicLibraryBase.C:79
static DLPROC getAddress(const LibHandle &lib, const std::string &fname)
Returns the pointer to a named function.
Definition: FFaDynamicLibraryBase.C:141
std::pair< DLPROC, LanguageBinding > cache_info
Function pointer with language binding.
Definition: FFaDynamicLibraryBase.H:72
DLPROC getProcAddress(const std::string &fName, size_t procID) const
Returns the function pointer for the given function.
Definition: FFaDynamicLibraryBase.C:237
const char * getLibrary(size_t idx=1) const
Returns the file name of the dynamic library, if loaded.
Definition: FFaDynamicLibraryBase.C:128