use call prefix to load backends

This commit is contained in:
psychocrypt
2017-09-30 23:46:08 +02:00
parent d80cc9061d
commit 21463c59c7
3 changed files with 10 additions and 4 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
#pragma once
#include "xmrstak/misc/environment.hpp"
#include "xmrstak/params.hpp"
#include <thread>
#include <atomic>
@@ -36,7 +37,7 @@ struct plugin
return;
}
#else
libBackend = dlopen((std::string("./lib") + libName + ".so").c_str(), RTLD_LAZY);
libBackend = dlopen((params::inst().executablePrefix + "/lib" + libName + ".so").c_str(), RTLD_LAZY);
if(!libBackend)
{
std::cerr << "WARNING: "<< m_backendName <<" cannot load backend library: " << dlerror() << std::endl;
+5 -3
View File
@@ -60,7 +60,8 @@ void help()
using namespace std;
using namespace xmrstak;
cout<<"Usage: "<<params::inst().executablePrefix<<" [--help|-h] [--benchmark] [-c CONFIGFILE] [CONFIG FILE]"<<endl;
cout<<"Usage: "<<params::inst().binaryName<<" [OPTIONS] [CONFIG FILE]"<<endl;
}
int main(int argc, char *argv[])
@@ -85,8 +86,9 @@ int main(int argc, char *argv[])
// try windows "\"
pos = pathWithName.rfind("\\");
}
params::inst().executablePrefix = std::string(pathWithName, 0, pos);
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);
for(int i = 1; i < argc; ++i)
{
+3
View File
@@ -19,6 +19,7 @@ struct params
}
std::string executablePrefix;
std::string binaryName;
bool useAMD;
bool useNVIDIA;
bool useCPU;
@@ -33,6 +34,8 @@ struct params
std::string configFileCPU;
params() :
binaryName("xmr-stak"),
executablePrefix("./"),
useAMD(true),
useNVIDIA(true),
useCPU(true),