mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: dlOpen: check error message string
This commit is contained in:
@ -1161,7 +1161,7 @@ int Foam::system(const std::string& command)
|
||||
}
|
||||
|
||||
|
||||
void* Foam::dlOpen(const fileName& lib)
|
||||
void* Foam::dlOpen(const fileName& lib, const bool check)
|
||||
{
|
||||
if (POSIX::debug)
|
||||
{
|
||||
@ -1170,6 +1170,13 @@ void* Foam::dlOpen(const fileName& lib)
|
||||
}
|
||||
void* handle = ::dlopen(lib.c_str(), RTLD_LAZY|RTLD_GLOBAL);
|
||||
|
||||
if (!handle && check)
|
||||
{
|
||||
WarningIn("dlOpen(const fileName&, const bool)")
|
||||
<< "dlopen error : " << ::dlerror()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
if (POSIX::debug)
|
||||
{
|
||||
std::cout
|
||||
|
||||
@ -143,8 +143,8 @@ Foam::functionEntries::codeStream::getFunction
|
||||
}
|
||||
else
|
||||
{
|
||||
// Uncached opening of libPath
|
||||
lib = dlOpen(libPath);
|
||||
// Uncached opening of libPath. Do not complain if cannot be loaded
|
||||
lib = dlOpen(libPath, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,7 +226,7 @@ Foam::functionEntries::codeStream::getFunction
|
||||
else
|
||||
{
|
||||
// Uncached opening of libPath
|
||||
lib = dlOpen(libPath);
|
||||
lib = dlOpen(libPath, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -78,7 +78,7 @@ bool Foam::dlLibraryTable::open
|
||||
{
|
||||
if (functionLibName.size())
|
||||
{
|
||||
void* functionLibPtr = dlOpen(functionLibName);
|
||||
void* functionLibPtr = dlOpen(functionLibName, verbose);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
||||
@ -197,8 +197,9 @@ bool ping(const string&, const label timeOut=10);
|
||||
//- Execute the specified command
|
||||
int system(const std::string& command);
|
||||
|
||||
//- open a shared library. Return handle to library
|
||||
void* dlOpen(const fileName& lib);
|
||||
//- open a shared library. Return handle to library. Print error message
|
||||
// if library cannot be loaded (check = true)
|
||||
void* dlOpen(const fileName& lib, const bool check = true);
|
||||
|
||||
//- Close a dlopened library using handle. Return true if successful
|
||||
bool dlClose(void*);
|
||||
|
||||
Reference in New Issue
Block a user