mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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:
committed by
Andrew Heather
parent
6789e7477b
commit
1ccddd04ef
@ -1197,11 +1197,23 @@ void* Foam::dlOpen(const fileName& libName, const bool check)
|
|||||||
|
|
||||||
void* handle = ::LoadLibrary(libso.c_str());
|
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
|
// Try with 'lib' prefix
|
||||||
libso = "lib" + libso;
|
libso = "lib" + libso;
|
||||||
handle = ::LoadLibrary(libso.c_str());
|
handle = ::LoadLibrary(libso.c_str());
|
||||||
|
|
||||||
|
if (MSwindows::debug)
|
||||||
|
{
|
||||||
|
std::cout
|
||||||
|
<< "dlOpen(const fileName&)"
|
||||||
|
<< " : dlopen of " << libso << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handle)
|
if (handle)
|
||||||
|
|||||||
@ -1670,11 +1670,22 @@ void* Foam::dlOpen(const fileName& libName, const bool check)
|
|||||||
{
|
{
|
||||||
fileName libso;
|
fileName libso;
|
||||||
|
|
||||||
if (!libName.startsWith("lib"))
|
if
|
||||||
|
(
|
||||||
|
libName.find('/') == std::string::npos
|
||||||
|
&& !libName.startsWith("lib")
|
||||||
|
)
|
||||||
{
|
{
|
||||||
// Try with 'lib' prefix
|
// Try with 'lib' prefix
|
||||||
libso = "lib" + libName;
|
libso = "lib" + libName;
|
||||||
handle = ::dlopen(libso.c_str(), ldflags);
|
handle = ::dlopen(libso.c_str(), ldflags);
|
||||||
|
|
||||||
|
if (POSIX::debug)
|
||||||
|
{
|
||||||
|
std::cout
|
||||||
|
<< "dlOpen(const fileName&)"
|
||||||
|
<< " : dlopen of " << libso << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1687,6 +1698,13 @@ void* Foam::dlOpen(const fileName& libName, const bool check)
|
|||||||
{
|
{
|
||||||
libso = libso.lessExt().ext(EXT_SO);
|
libso = libso.lessExt().ext(EXT_SO);
|
||||||
handle = ::dlopen(libso.c_str(), ldflags);
|
handle = ::dlopen(libso.c_str(), ldflags);
|
||||||
|
|
||||||
|
if (POSIX::debug)
|
||||||
|
{
|
||||||
|
std::cout
|
||||||
|
<< "dlOpen(const fileName&)"
|
||||||
|
<< " : dlopen of " << libso << std::endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user