10 void* handle = dlopen(libName.c_str(), RTLD_LAZY);
20 createIt = (
UserActionPlugin* (*)())dlsym(handle, std::string(
"create" + pluginName).c_str());
34 std::cerr <<
"[ PluginLoader ] : Failed to create plugin " << pluginName <<
" from lib "
36 throw std::runtime_error(
"Failed to create the plugin.");
40 std::cerr <<
"[ PluginLoader ] : Failed to find create function for plugin " << pluginName <<
" in lib "
42 throw std::runtime_error(
"Failed to find library function for creating plugin.");
46 std::cerr <<
"[ PluginLoader ] : Could not open " << libName <<
" plugin lib." <<
std::endl;
47 throw std::runtime_error(
"Plugin lib not found.");
70 std::map<UserActionPlugin*, void*>::iterator it;
77 std::cerr <<
"[ PluginLoader ] : Failed to find handle for " << plugin->
getName() <<
" plugin!!!" <<
std::endl;
78 throw std::runtime_error(
"Failed to find handle for plugin.");
82 std::cerr <<
"[ PluginLoader ] : Ignoring null plugin argument. " <<
std::endl;
UserActionPlugin * create(std::string pluginName, std::string libName)
std::map< UserActionPlugin *, void * > pluginHandles_
void destroy(UserActionPlugin *plugin)
virtual std::string getName()=0