Merge pull request #86 from psychocrypt/topic-searchBackendLibraries

search for linux backend plugins
This commit is contained in:
fireice-uk
2017-11-02 18:18:49 +00:00
committed by GitHub
3 changed files with 17 additions and 4 deletions
+8 -1
View File
@@ -43,7 +43,14 @@ struct plugin
// `.dylib` Mac OS X file extention for dynamic libraries
fileExtension = ".dylib";
# endif
libBackend = dlopen((params::inst().executablePrefix + "/lib" + libName + fileExtension).c_str(), RTLD_LAZY);
// search library in working directory
libBackend = dlopen(("./lib" + libName + fileExtension).c_str(), RTLD_LAZY);
// fallback to binary directory
if(!libBackend)
libBackend = dlopen((params::inst().executablePrefix + "lib" + libName + fileExtension).c_str(), RTLD_LAZY);
// try use LD_LIBRARY_PATH
if(!libBackend)
libBackend = dlopen(("lib" + libName + fileExtension).c_str(), RTLD_LAZY);
if(!libBackend)
{
std::cerr << "WARNING: "<< m_backendName <<" cannot load backend library: " << dlerror() << std::endl;
+8 -2
View File
@@ -106,15 +106,21 @@ int main(int argc, char *argv[])
using namespace xmrstak;
std::string pathWithName(argv[0]);
auto pos = pathWithName.rfind("/");
std::string seperator("/");
auto pos = pathWithName.rfind(seperator);
if(pos == std::string::npos)
{
// try windows "\"
pos = pathWithName.rfind("\\");
seperator = "\\";
pos = pathWithName.rfind(seperator);
}
params::inst().binaryName = std::string(pathWithName, pos + 1, std::string::npos);
if(params::inst().binaryName.compare(pathWithName) != 0)
{
params::inst().executablePrefix = std::string(pathWithName, 0, pos);
params::inst().executablePrefix += seperator;
}
bool userSetPasswd = false;
for(int i = 1; i < argc; ++i)
+1 -1
View File
@@ -37,7 +37,7 @@ struct params
params() :
binaryName("xmr-stak"),
executablePrefix("./"),
executablePrefix(""),
useAMD(true),
useNVIDIA(true),
useCPU(true),