# HG changeset patch # User Sebastien Jodogne # Date 1582712195 -3600 # Node ID b7087f9280507eb279d97b06807001ec31df5575 # Parent 9107cca846b6e9368c705ea482f30884d28a5d30 use of RTLD_DEEPBIND in dlopen() while loading plugins diff -r 9107cca846b6 -r b7087f928050 Core/SharedLibrary.cpp --- a/Core/SharedLibrary.cpp Tue Feb 25 22:46:38 2020 +0100 +++ b/Core/SharedLibrary.cpp Wed Feb 26 11:16:35 2020 +0100 @@ -62,7 +62,19 @@ } #elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) || defined(__OpenBSD__) - handle_ = ::dlopen(path_.c_str(), RTLD_NOW); + + /** + * "RTLD_LOCAL" is the default, and is only present to be + * explicit. "RTLD_DEEPBIND" was added in Orthanc 1.6.0, in order + * to avoid crashes while loading plugins from the LSB binaries of + * the Orthanc core. + **/ +#if defined(RTLD_DEEPBIND) // This is a GNU extension + handle_ = ::dlopen(path_.c_str(), RTLD_NOW | RTLD_LOCAL | RTLD_DEEPBIND); +#else + handle_ = ::dlopen(path_.c_str(), RTLD_NOW | RTLD_LOCAL); +#endif + if (handle_ == NULL) { std::string explanation;