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 =
"" 251 label
push_back(
const UList<fileName>& libNames);
256 bool open(
bool verbose =
true);
261 void*
open(
const fileName& libName,
bool verbose =
true);
265 bool open(
const UList<fileName>& libNames,
bool verbose =
true);
271 std::initializer_list<fileName> libNames,
277 void close(
bool verbose =
true);
281 bool close(
const fileName& libName,
bool verbose =
true);
290 const word& libsEntry,
302 template<
class TablePtr>
306 const word& libsEntry,
307 const TablePtr& tablePtr,
330 label
append(
const UList<fileName>& libNames)
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.
const UList< fileName > & names() const noexcept
Names of the libraries in use, or requested.
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.
const UList< void * > & pointers() const noexcept
Pointers to the libraries in use. Access with caution.
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.
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.
bool push_back(const fileName &libName)
Add to the list of names, but do not yet open.
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.
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 push_back()...
static int dlcloseOnTerminate
Use dlclose() when clearing the dlLibraryTable.
label size() const noexcept
The number of libraries loaded by the table.