94 std::string d_filename;
95 void *d_lib =
nullptr;
101 d_lib = dlopen(d_filename.c_str(), RTLD_LAZY | RTLD_GLOBAL);
102 BESDEBUG(
"bes",
"BESPlugin: plug in handler:" << d_filename <<
", " << d_lib << std::endl);
103 if (d_lib ==
nullptr) {
104 throw NoSuchLibrary(std::string(dlerror()), __FILE__, __LINE__);
112 BESPlugin() =
delete;
113 BESPlugin(
const BESPlugin &p) =
delete;
119 explicit BESPlugin(
const std::string &filename) : d_filename(filename) { }
131 void *maker = dlsym(get_lib(),
"maker");
133 throw NoSuchObject(std::string(dlerror()), __FILE__, __LINE__);
136 typedef M *(*maker_func_ptr)();
137 maker_func_ptr my_maker = *
reinterpret_cast<maker_func_ptr*
>(&maker);
138 M *my_M = my_maker();
143 void dump(std::ostream &strm)
const override {
144 strm <<
"BESPlugin::dump - (" << std::ios::hex <<
this <<
")" << std::endl;
145 strm <<
" plugin name: " << d_filename << std::endl;
146 strm <<
" library handle: " << std::ios::hex << d_lib << std::endl;