123 d_lib = dlopen(d_filename.c_str(), RTLD_NOW|RTLD_LOCAL);
125 throw NoSuchLibrary(
string( dlerror() ), __FILE__, __LINE__ ) ;
137 BESPlugin(
const string &filename) : d_filename(filename), d_lib(0) {}
153 void *
maker = dlsym(get_lib(),
"maker");
155 throw NoSuchObject(
string( dlerror() ), __FILE__, __LINE__ ) ;
158 typedef M *(*maker_func_ptr)();
159 maker_func_ptr my_maker = *
reinterpret_cast<maker_func_ptr*
>(&
maker);
160 M *my_M = (my_maker)();
165 virtual void dump( ostream &strm )
const 167 strm <<
"BESPlugin::dump - (" << (
void *)
this <<
")" << endl ;
168 strm <<
" plugin name: " << d_filename << endl ;
169 strm <<
" library handle: " << (
void *)d_lib << endl ;
173 #endif // T_BESPlugin_h exception thrown if an internal error is found and is fatal to the BES
exception thrown if inernal error encountered
Thrown as an exception when BESPlugin cannot find the named shareable library.
Thrown as an exception when BESPlugin cannot find or run the maker() function in a shared library alr...
BESAbstractModule * maker()
NoSuchObject(const string &msg, const string &file, int line)
M * instantiate()
Instantiate the object.
Base object for bes objects.
NoSuchLibrary(const string &msg, const string &file, int line)
virtual void dump(ostream &strm) const
dump the contents of this object to the specified ostream
virtual ~BESPlugin()
The destructor closes the library.
BESPlugin(const string &filename)
Create a new BESPlugin.
BESPlugin provides a mechanism that can load C++ classes at runtime.