Skip to content

Commit

Permalink
dladdr return now clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
Iximiel committed Dec 5, 2023
1 parent d4ed847 commit 7d301b4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/tools/DLLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,16 @@ DLLoader::EnsureGlobalDLOpen::EnsureGlobalDLOpen(const void *symbol) noexcept {
// If the address specified in addr could not be matched to a shared
// object, then these functions return 0. In this case, an error
// message is not available via dlerror(3).
if(dladdr(symbol, &info)!=0) {
int zeroIsError=dladdr(symbol, &info);
if(zeroIsError!=0) {
//This "promotes" to GLOBAL the object with the symbol pointed by ptr
handle_ = dlopen(info.dli_fname, RTLD_GLOBAL | RTLD_NOW);
} else {
std::fprintf(stderr,
"+++WARNING+++"
"Failure in finding any object that contains the symbol %p.\n",
symbol);

}
#else
std::fprintf(stderr,
Expand Down

0 comments on commit 7d301b4

Please sign in to comment.