43 #ifndef Foam_dlLibraryTable_H 44 #define Foam_dlLibraryTable_H 58 Ostream& operator<<(Ostream&, const InfoProxy<dlLibraryTable>&);
70 static std::unique_ptr<dlLibraryTable> global_;
86 static bool functionHook
90 const std::string& funcName,
92 const std::string& context
98 void* openLibrary(
const fileName& libName,
bool verbose);
154 std::initializer_list<fileName> libNames,
162 const word& libsEntry,
172 const word& libsEntry,
200 const std::string& funcName,
201 const bool verbose =
false,
202 const std::string& context =
"" 212 const std::string& funcName,
213 const bool verbose =
false,
214 const std::string& context =
"" 246 bool append(
const fileName& libName);
250 label
append(
const UList<fileName>& libNames);
254 bool open(
bool verbose =
true);
259 void*
open(
const fileName& libName,
bool verbose =
true);
263 bool open(
const UList<fileName>& libNames,
bool verbose =
true);
269 std::initializer_list<fileName> libNames,
275 void close(
bool verbose =
true);
279 bool close(
const fileName& libName,
bool verbose =
true);
300 template<
class TablePtr>
304 const word& libsEntry,
305 const TablePtr& tablePtr,
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...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
InfoProxy< dlLibraryTable > info() const noexcept
Return info proxy, used to print library table information to a stream.
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...
bool append(const fileName &libName)
Add to the list of names, but do not yet open.
bool empty() const noexcept
True if there are no libraries loaded by the table.
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.
label size() const noexcept
The number of libraries loaded by the table.