42 void Foam::codedBase::checkLibrary
44 const dictionary&
dict,
45 const fileName& libPath,
47 const string& uniqueFuncName,
54 const loaderFunctionType
function =
55 reinterpret_cast<loaderFunctionType
>
57 dlSym(lib, uniqueFuncName)
68 <<
"Failed looking up symbol " << uniqueFuncName <<
nl
73 void* Foam::codedBase::loadLibrary
75 const dictionary&
dict,
76 const fileName& libPath,
77 const string& uniqueFuncName
89 checkLibrary(
dict, libPath, lib, uniqueFuncName,
true);
96 void Foam::codedBase::unloadLibrary
98 const dictionary&
dict,
99 const fileName& libPath,
100 const string& uniqueFuncName
115 checkLibrary(
dict, libPath, lib, uniqueFuncName,
false);
120 <<
"Failed unloading library " << libPath
128 const dictionary&
dict,
130 const word& codeDictVar
133 verbatimString codeString;
163 const word& codeOptionsFileName,
166 const bool reloadable
180 reloadable_(reloadable)
206 if (!isalpha(result[0]))
209 <<
"Cannot construct code name from function name \"" <<
name
210 <<
"\" as the first character is not alphabetic"
216 const bool valid = isalnum(result[i]) || result[i] ==
'_';
232 const fileName libPath = this->libPath();
240 Info<<
"Using dynamicCode for " <<
type() <<
" " << codeName()
253 if (!loadLibrary(
dict, libPath, codeSha1Name()))
257 if (!loadLibrary(
dict, libPath, codeSha1Name()))
265 oldLibPath_ = libPath;
Functions used by OpenFOAM that are specific to POSIX compliant operating systems and need to be repl...
graph_traits< Graph >::vertices_size_type size_type
Base class for coded functionObjects, fvModels, Function1, Function2.
codedBase(const word &name, const dictionary &dict, const wordList &codeKeys, const wordList &codeDictVars, const word &codeOptionsFileName, const wordList &compileFiles, const wordList ©Files, const bool reloadable=true)
Construct from name and dictionary.
virtual ~codedBase()
Destructor.
static word codedName(const word &name)
Create a coded name from the given name.
bool updateLibrary(const dictionary &dict) const
Update library from given updated dictionary as required.
const fileName & name() const
Return the dictionary name.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
T lookupOrDefault(const word &, const T &) const
Find and return a T, if not found return the given default.
bool found(const word &, bool recursive=false, bool patternMatch=true) const
Search dictionary for given keyword.
virtual label startLineNumber() const
Return line number of first token in dictionary.
bool close(const fileName &name, const bool verbose=true)
Close the named library, optionally with warnings if problems occur.
void * findLibrary(const fileName &libName)
Find the handle of the named library.
Encapsulation of dynamic code dictionaries and functionality.
fileName libPath() const
Library path for specified code name.
void * loadLibrary(const fileName &libPath) const
static word libraryBaseName(const fileName &libPath)
Return the library basename without leading 'lib' or trailing '.so'.
A class for handling file names.
A class for handling verbatimStrings, derived from string.
static const verbatimString null
An empty verbatimString.
A class for handling words, derived from string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
bool valid(const PtrList< ModelType > &l)
string & inplaceExpandCodeString(string &, const dictionary &dict, const word &dictVar="dict", const char sigil='$')
Inplace expand occurrences of variables according to the dictionary.
errorManipArg< error, int > exit(error &err, const int errNo=1)
dlLibraryTable libs
Table of loaded dynamic libraries.
bool dlSymFound(void *handle, const std::string &symbol)
Report if symbol in a dlopened library could be found.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
void * dlSym(void *handle, const std::string &symbol)
Lookup a symbol in a dlopened library using handle to library.
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.