43 #include "BESInternalFatalError.h"
44 #include "BESInternalError.h"
47 #undef UNPLUG_HANDLERS
54 NoSuchLibrary(
const std::string &msg,
const std::string &file,
int line) :
65 NoSuchObject(
const std::string &msg,
const std::string &file,
int line) :
94 std::string d_filename;
130 d_lib = dlopen(d_filename.c_str(), RTLD_NOW | RTLD_GLOBAL);
131 BESDEBUG(
"bes",
"BESPlugin: plug in handler:" << d_filename <<
", " << d_lib << std::endl);
133 throw NoSuchLibrary(std::string(dlerror()), __FILE__, __LINE__);
146 d_filename(filename), d_lib(0)
154 BESDEBUG(
"bes",
"BESPlugin: unplugging handler:" << d_filename <<
", " << d_lib << std::endl);
155 #ifdef UNPLUG_HANDLERS
171 void *maker = dlsym(get_lib(),
"maker");
173 throw NoSuchObject(std::string(dlerror()), __FILE__, __LINE__);
176 typedef M *(*maker_func_ptr)();
177 maker_func_ptr my_maker = *
reinterpret_cast<maker_func_ptr*
>(&maker);
178 M *my_M = (my_maker)();
183 virtual void dump(std::ostream &strm)
const
185 strm <<
"BESPlugin::dump - (" << (
void *)
this <<
")" << std::endl;
186 strm <<
" plugin name: " << d_filename << std::endl;
187 strm <<
" library handle: " << (
void *) d_lib << std::endl;
191 #endif // T_BESPlugin_h