backport SharedLibrary changes from 1.4.2-p1

This commit is contained in:
Marian Krivos
2011-11-04 18:56:08 +00:00
parent 5084562770
commit 97ec3f5bf6
16 changed files with 155 additions and 96 deletions

View File

@@ -62,16 +62,17 @@ SharedLibraryImpl::~SharedLibraryImpl()
}
void SharedLibraryImpl::loadImpl(const std::string& path)
void SharedLibraryImpl::loadImpl(const std::string& path, int flags)
{
FastMutex::ScopedLock lock(_mutex);
if (_handle) throw LibraryAlreadyLoadedException(path);
int flags = RTLD_LAZY | RTLD_GLOBAL;
#if defined(RTLD_DEEPBIND)
flags |= RTLD_DEEPBIND;
#endif
_handle = dlopen(path.c_str(), flags);
int realFlags = RTLD_LAZY;
if (flags & SHLIB_LOCAL_IMPL)
realFlags |= RTLD_LOCAL;
else
realFlags |= RTLD_GLOBAL;
_handle = dlopen(path.c_str(), realFlags);
if (!_handle)
{
const char* err = dlerror();