mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-27 02:53:10 +01:00
trunk/branch integration: fix
This commit is contained in:
@@ -67,7 +67,11 @@ void SharedLibraryImpl::loadImpl(const std::string& path)
|
|||||||
FastMutex::ScopedLock lock(_mutex);
|
FastMutex::ScopedLock lock(_mutex);
|
||||||
|
|
||||||
if (_handle) throw LibraryAlreadyLoadedException(path);
|
if (_handle) throw LibraryAlreadyLoadedException(path);
|
||||||
_handle = dlopen(path.c_str(), RTLD_LAZY | RTLD_GLOBAL);
|
int flags = RTLD_LAZY | RTLD_GLOBAL;
|
||||||
|
#if defined(RTLD_DEEPBIND)
|
||||||
|
flags |= RTLD_DEEPBIND;
|
||||||
|
#endif
|
||||||
|
_handle = dlopen(path.c_str(), flags);
|
||||||
if (!_handle)
|
if (!_handle)
|
||||||
{
|
{
|
||||||
const char* err = dlerror();
|
const char* err = dlerror();
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "Poco/SharedLibrary_WIN32.h"
|
#include "Poco/SharedLibrary_WIN32.h"
|
||||||
|
#include "Poco/Path.h"
|
||||||
#include "Poco/UnWindows.h"
|
#include "Poco/UnWindows.h"
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#include "Poco/SharedLibrary_WIN32U.h"
|
#include "Poco/SharedLibrary_WIN32U.h"
|
||||||
#include "Poco/UnicodeConverter.h"
|
#include "Poco/UnicodeConverter.h"
|
||||||
|
#include "Poco/Path.h"
|
||||||
#include "Poco/UnWindows.h"
|
#include "Poco/UnWindows.h"
|
||||||
|
|
||||||
|
|
||||||
@@ -61,9 +62,14 @@ void SharedLibraryImpl::loadImpl(const std::string& path)
|
|||||||
FastMutex::ScopedLock lock(_mutex);
|
FastMutex::ScopedLock lock(_mutex);
|
||||||
|
|
||||||
if (_handle) throw LibraryAlreadyLoadedException(_path);
|
if (_handle) throw LibraryAlreadyLoadedException(_path);
|
||||||
|
DWORD flags(0);
|
||||||
|
#if !defined(_WIN32_WCE)
|
||||||
|
Path p(path);
|
||||||
|
if (p.isAbsolute()) flags |= LOAD_WITH_ALTERED_SEARCH_PATH;
|
||||||
|
#endif
|
||||||
std::wstring upath;
|
std::wstring upath;
|
||||||
UnicodeConverter::toUTF16(path, upath);
|
UnicodeConverter::toUTF16(path, upath);
|
||||||
_handle = LoadLibraryW(upath.c_str());
|
_handle = LoadLibraryExW(upath.c_str(), 0, flags);
|
||||||
if (!_handle) throw LibraryLoadException(path);
|
if (!_handle) throw LibraryLoadException(path);
|
||||||
_path = path;
|
_path = path;
|
||||||
}
|
}
|
||||||
@@ -94,7 +100,13 @@ void* SharedLibraryImpl::findSymbolImpl(const std::string& name)
|
|||||||
|
|
||||||
if (_handle)
|
if (_handle)
|
||||||
{
|
{
|
||||||
|
#if defined(_WIN32_WCE)
|
||||||
|
std::wstring uname;
|
||||||
|
UnicodeConverter::toUTF16(name, uname);
|
||||||
|
return (void*) GetProcAddressW((HMODULE) _handle, uname.c_str());
|
||||||
|
#else
|
||||||
return (void*) GetProcAddress((HMODULE) _handle, name.c_str());
|
return (void*) GetProcAddress((HMODULE) _handle, name.c_str());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else return 0;
|
else return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user