43 #ifndef dlLibraryTable_H 44 #define dlLibraryTable_H 58 Ostream& operator<<(Ostream& os, const InfoProxy<dlLibraryTable>& info);
69 static std::unique_ptr<dlLibraryTable> global_;
85 static bool functionHook
89 const std::string& funcName,
91 const std::string& context
97 void* openLibrary(
const fileName& libName,
bool verbose);
153 std::initializer_list<fileName> libNames,
161 const word& libsEntry,
171 const word& libsEntry,
199 const std::string& funcName,
200 const bool verbose =
false,
201 const std::string& context =
"" 211 const std::string& funcName,
212 const bool verbose =
false,
213 const std::string& context =
"" 245 bool append(
const fileName& libName);
249 label
append(
const UList<fileName>& libNames);
253 bool open(
bool verbose =
true);
258 void*
open(
const fileName& libName,
bool verbose =
true);
262 bool open(
const UList<fileName>& libNames,
bool verbose =
true);
268 std::initializer_list<fileName> libNames,
274 void close(
bool verbose =
true);
278 bool close(
const fileName& libName,
bool verbose =
true);
299 template<
class TablePtr>
303 const word& libsEntry,
304 const TablePtr& tablePtr,
bool empty() const
True if there are no libraries loaded by the table.
A class for handling file names.
ClassName("dlLibraryTable")
Declare name of the class and its debug switch.
void operator=(const dlLibraryTable &)=delete
No copy assignment.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
label size() const
The number of libraries loaded by the table.
void clear()
Clears the table, without attempting to close the libraries.
List< fileName > loaded() const
Names of the libraries in use.
~dlLibraryTable()
Destructor. Closes all libraries loaded by the table.
static dlLibraryTable & libs()
Table of global libraries.
const UList< fileName > & names() const
Names of the libraries in use, or requested.
void close(bool verbose=true)
Close all libraries loaded by the table and remove the closed functions from the table.
void(* loaderType)(bool)
Global loader/unloader function type (C-linkage)
static bool loadHook(void *handle, const std::string &funcName, const bool verbose=false, const std::string &context="")
Low-level interface to execute global "void funcName(true)" from the library, typically for additiona...
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
static word basename(const fileName &libPath)
Library basename without leading 'lib' or trailing '.so'.
A class for handling words, derived from Foam::string.
static word fullname(word libName)
Library fullname, prefix with 'lib', suffix with '.so'.
dlLibraryTable()=default
Default construct.
A table of dynamically loaded libraries.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
InfoProxy< dlLibraryTable > info() const
Return info proxy.
bool append(const fileName &libName)
Add to the list of names, but do not yet open.
const UList< void * > & pointers() const
Pointers to the libraries in use. Access with caution.
static bool unloadHook(void *handle, const std::string &funcName, const bool verbose=false, const std::string &context="")
Low-level interface to execute global "void funcName(false)" from the library, typically for unloadin...
A helper class for outputting values to Ostream.
void * findLibrary(const fileName &libName)
Find the handle of the named library.
bool open(bool verbose=true)
Open named, but unopened libraries. These names will normally have been added with the append() metho...
static int dlcloseOnTerminate
Use dlclose() when clearing the dlLibraryTable.