ENH: more stringent check before adding 'lib' prefix (OSspecific)
- only prefix 'lib' for names without a path STYLE: add more OSspecific debug output for library loading
This commit is contained in:
parent
6789e7477b
commit
1ccddd04ef
@ -1197,11 +1197,23 @@ void* Foam::dlOpen(const fileName& libName, const bool check)
|
||||
|
||||
void* handle = ::LoadLibrary(libso.c_str());
|
||||
|
||||
if (!handle && !libso.startsWith("lib"))
|
||||
if
|
||||
(
|
||||
!handle
|
||||
&& libName.find('/') == std::string::npos
|
||||
&& !libso.startsWith("lib")
|
||||
)
|
||||
{
|
||||
// Try with 'lib' prefix
|
||||
libso = "lib" + libso;
|
||||
handle = ::LoadLibrary(libso.c_str());
|
||||
|
||||
if (MSwindows::debug)
|
||||
{
|
||||
std::cout
|
||||
<< "dlOpen(const fileName&)"
|
||||
<< " : dlopen of " << libso << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (handle)
|
||||
|
@ -1670,11 +1670,22 @@ void* Foam::dlOpen(const fileName& libName, const bool check)
|
||||
{
|
||||
fileName libso;
|
||||
|
||||
if (!libName.startsWith("lib"))
|
||||
if
|
||||
(
|
||||
libName.find('/') == std::string::npos
|
||||
&& !libName.startsWith("lib")
|
||||
)
|
||||
{
|
||||
// Try with 'lib' prefix
|
||||
libso = "lib" + libName;
|
||||
handle = ::dlopen(libso.c_str(), ldflags);
|
||||
|
||||
if (POSIX::debug)
|
||||
{
|
||||
std::cout
|
||||
<< "dlOpen(const fileName&)"
|
||||
<< " : dlopen of " << libso << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1687,6 +1698,13 @@ void* Foam::dlOpen(const fileName& libName, const bool check)
|
||||
{
|
||||
libso = libso.lessExt().ext(EXT_SO);
|
||||
handle = ::dlopen(libso.c_str(), ldflags);
|
||||
|
||||
if (POSIX::debug)
|
||||
{
|
||||
std::cout
|
||||
<< "dlOpen(const fileName&)"
|
||||
<< " : dlopen of " << libso << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user