4 #include <sys/utsname.h>
14 h=dlopen( fname, RTLD_GLOBAL | RTLD_NOW);
16 h=dlopen( fname, RTLD_NOW );
33 *v = dlsym(
h, sym_name );
65 struct utsname system;
68 if(std::string(system.sysname) ==
"Darwin")
69 ldpath = getenv(
"DYLD_LIBRARY_PATH");
71 ldpath = getenv(
"LD_LIBRARY_PATH");
72 std::stringstream path(ldpath);
76 while(std::getline(path,libpath,
':')) {
77 fullpath = libpath +
"/" + pluginlist;
78 file.open(fullpath.c_str());
79 if(file.good())
break;
84 std::string msg = std::string(
"Reading plugins from: ") + fullpath;
88 while(std::getline(file,line)) {
90 line=line.substr(0,line.find(
"#"));
94 if(line.length()==0)
continue;
96 std::stringstream sline(line);
100 std::getline(sline,library,
':');
102 while(sline >> word){
107 bool overWritten =
false;
135 "LoadPlugin " + pluginName);
137 std::vector<AutoLoadPlugin>::const_iterator iter =
fAutoPluginsLib.begin();
146 std::stringstream msg;
147 msg <<
"While loading plugin " << pluginName
148 <<
" attempt to autoload library "
150 <<
". Load failed!" << std::endl
151 <<
"DLL Error: " << dllError;
164 std::map<std::string, std::string>::iterator plugLibIter =
fPluginsLib.find(pluginName);
166 return QError(
QERR_UNKNOWN_ERR,std::string(
"Plugin: ") + pluginName +
" not found in libraries database");
169 std::stringstream msg;
170 msg <<
"Found library\n\t" << pluginName <<
":" <<
182 void (*factory_func)(void);
#define Q_BEGIN_NAMESPACE
std::string fullPathLibrary
std::set< std::string > fPluginLists
std::string fPluginPrefix
static QDLLLoader & GetInstance()
QError LoadPlugin(const std::string &name)
std::map< std::string, std::string > fPluginsLib
std::vector< AutoLoadPlugin > fAutoPluginsLib
QError Init(const std::string &pluginlist, const std::string &pluginPrefix)
QError GetSymbol(void **, const char *sym_name)
QDLLManager(const char *fname, const bool autoload=false)
error class with error type and description
static QMessageHandler * Get()
void Send(MsgLevel l, const std::string &sender, const std::string &msg)
std::string & DoubleSwallowSpaces(std::string &s)
remove spaces and tabs from both the beginning and the end of s