comparison Core/SharedLibrary.cpp @ 3786:3801435e34a1 SylvainRouquette/fix-issue169-95b752c

integration Orthanc-1.6.0->SylvainRouquette
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 19 Mar 2020 11:48:30 +0100
parents b7087f928050
children 626d5f4a5afb
comparison
equal deleted inserted replaced
3785:763533d6dd67 3786:3801435e34a1
1 /** 1 /**
2 * Orthanc - A Lightweight, RESTful DICOM Store 2 * Orthanc - A Lightweight, RESTful DICOM Store
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics 3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
4 * Department, University Hospital of Liege, Belgium 4 * Department, University Hospital of Liege, Belgium
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium 5 * Copyright (C) 2017-2020 Osimis S.A., Belgium
6 * 6 *
7 * This program is free software: you can redistribute it and/or 7 * This program is free software: you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as 8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation, either version 3 of the 9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version. 10 * License, or (at your option) any later version.
60 LOG(ERROR) << "LoadLibrary(" << path_ << ") failed: Error " << ::GetLastError(); 60 LOG(ERROR) << "LoadLibrary(" << path_ << ") failed: Error " << ::GetLastError();
61 throw OrthancException(ErrorCode_SharedLibrary); 61 throw OrthancException(ErrorCode_SharedLibrary);
62 } 62 }
63 63
64 #elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) || defined(__OpenBSD__) 64 #elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__) || defined(__OpenBSD__)
65 handle_ = ::dlopen(path_.c_str(), RTLD_NOW); 65
66 /**
67 * "RTLD_LOCAL" is the default, and is only present to be
68 * explicit. "RTLD_DEEPBIND" was added in Orthanc 1.6.0, in order
69 * to avoid crashes while loading plugins from the LSB binaries of
70 * the Orthanc core.
71 **/
72 #if defined(RTLD_DEEPBIND) // This is a GNU extension
73 handle_ = ::dlopen(path_.c_str(), RTLD_NOW | RTLD_LOCAL | RTLD_DEEPBIND);
74 #else
75 handle_ = ::dlopen(path_.c_str(), RTLD_NOW | RTLD_LOCAL);
76 #endif
77
66 if (handle_ == NULL) 78 if (handle_ == NULL)
67 { 79 {
68 std::string explanation; 80 std::string explanation;
69 const char *tmp = ::dlerror(); 81 const char *tmp = ::dlerror();
70 if (tmp) 82 if (tmp)