Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use RTLD_NOW for faster backend initialization. #2528

Merged
merged 11 commits into from
Sep 19, 2019
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