33 const std::unique_lock<std::mutex> lk(this->m_dll_mutex);
35 std::find(this->loaded_plugins.begin(), this->loaded_plugins.end(), dll);
36 if (loc_iter != this->loaded_plugins.end()) {
40 void* handle = ::dlopen(library, RTLD_LOCAL | RTLD_NOW);
41 if (handle ==
nullptr) {
42 ERROR_MSG(
"DLL::Loader::load : Unable to load library {}", library);
48 this->loaded_plugins.push_back(dll);
55 const std::unique_lock<std::mutex> lk(this->m_dll_mutex);
57 std::find(this->loaded_plugins.begin(), this->loaded_plugins.end(), dll);
58 if (loc_iter == this->loaded_plugins.end()) {
61 ::dlclose(loc_iter->handle);
62 this->loaded_plugins.erase(loc_iter);
67 for (
auto& dll : this->loaded_plugins) {
68 this->unload(dll.library_name.c_str());
void unload(const char *library)
int load(const char *library)
void ERROR_MSG(const std::string &errmsg, Args... args)