Skip to content

Commit

Permalink
Faster xmrstak_backend initialization, prevents unsupported binary in…
Browse files Browse the repository at this point in the history
… BUILD_STATIC=ON
  • Loading branch information
ddobreff committed Sep 12, 2019
1 parent fd19a5d commit 54dae74
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xmrstak/backend/plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ struct plugin
fileExtension = ".dylib";
#endif
// search library in working directory
libBackend = dlopen(("./lib" + libName + fileExtension).c_str(), RTLD_LAZY);
libBackend = dlopen(("./lib" + libName + fileExtension).c_str(), RTLD_NOW | RTLD_LAZY | RTLD_GLOBAL);
// fallback to binary directory
if(!libBackend)
libBackend = dlopen((params::inst().executablePrefix + "lib" + libName + fileExtension).c_str(), RTLD_LAZY);
libBackend = dlopen((params::inst().executablePrefix + "lib" + libName + fileExtension).c_str(), RTLD_NOW | RTLD_LAZY | RTLD_GLOBAL);
// try use LD_LIBRARY_PATH
if(!libBackend)
libBackend = dlopen(("lib" + libName + fileExtension).c_str(), RTLD_LAZY);
libBackend = dlopen(("lib" + libName + fileExtension).c_str(), RTLD_NOW | RTLD_LAZY | RTLD_GLOBAL);
if(!libBackend)
{
std::cerr << "WARNING: " << m_backendName << " cannot load backend library: " << dlerror() << std::endl;
Expand Down

0 comments on commit 54dae74

Please sign in to comment.