Skip to content
Snippets Groups Projects
Commit 21463c59 authored by psychocrypt's avatar psychocrypt
Browse files

use call prefix to load backends

parent d80cc906
No related branches found
No related tags found
No related merge requests found
#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;
......
......@@ -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)
{
......
......@@ -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),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment