Skip to content

Commit

Permalink
Try appending ".1" to library file name when searching for libraries …
Browse files Browse the repository at this point in the history
…on Linux
  • Loading branch information
Qining committed Feb 20, 2018
1 parent e84a859 commit 36623a3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions core/cc/dl_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
#elif TARGET_OS == GAPID_OS_OSX
# include <dlfcn.h>
# include <unistd.h>
#elif TARGET_OS == GAPID_OS_LINUX
# include <string.h>
# include <dlfcn.h>
#else
# include <dlfcn.h>
#endif
Expand Down Expand Up @@ -51,6 +54,16 @@ void* load(const char* name) {
}
}
return res;
#elif TARGET_OS == GAPID_OS_LINUX
void* res = dlopen(name, RTLD_NOW | RTLD_LOCAL);
if (res != nullptr) {
return res;
}
// Try name + ".1"
size_t len = strlen(name) + sizeof(".1");
char* fallback_name = new char[len];
strcat(fallback_name, ".1");
return dlopen(name, RTLD_NOW | RTLD_LOCAL);
#else
return dlopen(name, RTLD_NOW | RTLD_LOCAL);
#endif // TARGET_OS
Expand Down

0 comments on commit 36623a3

Please sign in to comment.