Browse Source

Use RTLD_DEEPBIND for loading plugins with dlopen() on Linux.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
c32004713d
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      src/plugin.cpp

+ 6
- 1
src/plugin.cpp View File

@@ -58,7 +58,12 @@ static void* loadLibrary(std::string libraryPath) {
// Change it back when we're finished // Change it back when we're finished
DEFER({system::setWorkingDirectory(cwd);}); DEFER({system::setWorkingDirectory(cwd);});
// Load library with dlopen // Load library with dlopen
void* handle = dlopen(libraryPath.c_str(), RTLD_NOW | RTLD_LOCAL);
void* handle = NULL;
#if defined ARCH_LIN
handle = dlopen(libraryPath.c_str(), RTLD_NOW | RTLD_DEEPBIND);
#elif defined ARCH_MAC
handle = dlopen(libraryPath.c_str(), RTLD_NOW | RTLD_LOCAL);
#endif
if (!handle) if (!handle)
throw Exception("Failed to load library %s: %s", libraryPath.c_str(), dlerror()); throw Exception("Failed to load library %s: %s", libraryPath.c_str(), dlerror());
#endif #endif


Loading…
Cancel
Save