28 #define YUILogComponent "ui" 31 #include "YUIPlugin.h" 34 #include "Libyui_config.h" 39 _pluginLibBaseName = std::string( pluginLibBaseName );
43 _pluginLibHandle = dlopen( pluginFilename.c_str(),
44 RTLD_NOW | RTLD_GLOBAL);
46 if ( ! _pluginLibHandle )
48 _errorMsg = dlerror();
50 yuiError() <<
"Could not load UI plugin \"" << pluginLibBaseName
51 <<
"\": " << _errorMsg
67 if ( _pluginLibHandle )
68 dlclose( _pluginLibHandle );
76 std::string pluginName = PLUGIN_PREFIX;
77 pluginName.append( _pluginLibBaseName );
78 pluginName.append( PLUGIN_SUFFIX );
80 YPath plugin( PLUGINDIR, pluginName );
88 if ( ! _pluginLibHandle )
91 void * addr = dlsym( _pluginLibHandle, symbol );
95 yuiError() <<
"Could not locate symbol \"" << symbol
106 return _pluginLibHandle == 0;
112 return _pluginLibHandle != 0;
std::string path()
Returns the full path of the file if found; if not found just the filename given in constructor...
std::string errorMsg() const
Returns a human readable (but in most cases untranslated) error message if there was an error...
virtual ~YUIPlugin()
Destructor.
YUIPlugin(const char *pluginLibBaseName)
Constructor: Load the specified plugin library from the standard UI plugin directory (/usr/lib/yui/)...
void * locateSymbol(const char *symbol)
Try to locate the specified symbol (function or global variable) in the plugin library.
bool success() const
Returns 'true' if there was no error loading the plugin.
bool error() const
Returns 'true' if there was an error loading the plugin.
std::string pluginLibFullPath() const
Returns the full path of the plugin library.
void unload()
Unload this plugin.