diff options
author | Jose <jose@zeroc.com> | 2011-03-25 21:38:25 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2011-03-25 21:38:25 +0100 |
commit | fca9fb69b0f9289639f06624b177143596aba38b (patch) | |
tree | bdb8ebdb3e33bcbdfa41fc1adfc6dde75b75a1d0 /cpp/src/Ice/DynamicLibrary.cpp | |
parent | 4829 - TlsFree / pthread_key_delete missing from ~SharedDbEnv (diff) | |
download | ice-fca9fb69b0f9289639f06624b177143596aba38b.tar.bz2 ice-fca9fb69b0f9289639f06624b177143596aba38b.tar.xz ice-fca9fb69b0f9289639f06624b177143596aba38b.zip |
5031 - No error handling in Windows implementation of DynamicLibrary
Diffstat (limited to 'cpp/src/Ice/DynamicLibrary.cpp')
-rw-r--r-- | cpp/src/Ice/DynamicLibrary.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/cpp/src/Ice/DynamicLibrary.cpp b/cpp/src/Ice/DynamicLibrary.cpp index c9be9714d92..213dd955f12 100644 --- a/cpp/src/Ice/DynamicLibrary.cpp +++ b/cpp/src/Ice/DynamicLibrary.cpp @@ -164,19 +164,23 @@ IceInternal::DynamicLibrary::load(const string& lib) #endif _hnd = dlopen(lib.c_str(), flags); +#endif if(_hnd == 0) { // // Remember the most recent error in _err. // +#ifdef _WIN32 + _err = IceUtilInternal::lastErrorToString(); +#else const char* err = dlerror(); - if(err) { _err = err; } - } #endif + } + return _hnd != 0; } @@ -187,25 +191,30 @@ IceInternal::DynamicLibrary::getSymbol(const string& name) #ifdef _WIN32 # ifdef __BCPLUSPLUS__ string newName = "_" + name; - return GetProcAddress(_hnd, newName.c_str()); + symbol_type result = GetProcAddress(_hnd, newName.c_str()); # else - return GetProcAddress(_hnd, name.c_str()); + symbol_type result = GetProcAddress(_hnd,name.c_str()); # endif #else symbol_type result = dlsym(_hnd, name.c_str()); +#endif + if(result == 0) { // // Remember the most recent error in _err. // - const char* err = dlerror(); +#ifdef _WIN32 + _err = IceUtilInternal::lastErrorToString(); +#else + const char* err = dlerror(); if(err) { _err = err; } +#endif } return result; -#endif } const string& |