28 #define YUILogComponent "ui" 31 #include "YUIPlugin.h" 34 #include "Libyui_config.h" 46 _pluginLibHandle = dlopen( pluginFilename.c_str(),
47 RTLD_NOW | RTLD_GLOBAL);
49 if ( ! _pluginLibHandle )
51 _errorMsg = dlerror();
54 <<
"\": " << _errorMsg
70 if ( _pluginLibHandle )
71 dlclose( _pluginLibHandle );
79 string pluginName = PLUGIN_PREFIX;
80 pluginName.append( _pluginLibBaseName );
81 pluginName.append( PLUGIN_SUFFIX );
83 YPath plugin( PLUGINDIR, pluginName );
91 if ( ! _pluginLibHandle )
94 void * addr = dlsym( _pluginLibHandle, symbol );
98 yuiError() <<
"Could not locate symbol \"" << symbol
109 return _pluginLibHandle == 0;
115 return _pluginLibHandle != 0;
std::string path()
Returns the full path of the file if found; if not found just the filename given in constructor...
virtual ~YUIPlugin()
Destructor.
std::string pluginLibFullPath() const
Returns the full path of the plugin library.
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.
std::string pluginLibBaseName() const
Returns the base name of the plugin library.
bool error() const
Returns 'true' if there was an error loading the plugin.
void unload()
Unload this plugin.
std::string errorMsg() const
Returns a human readable (but in most cases untranslated) error message if there was an error...