CqPluginBase::~CqPluginBase() { while ( !m_activeHandles.empty() ) { if ( m_activeHandles.front() != NULL ) DLClose( m_activeHandles.front() ); }; };
const void* DLSym(const std::string& Name, std::string* Err) { if (const void* Self = ::dlopen(nullptr, RTLD_GLOBAL)) { // get dlopen error if there is one DLErr(Err); const void* Sym = ::dlsym(const_cast<void*>(Self), Name.c_str()); // overwrite error if dlsym caused one DLErr(Err); // only get dlclose error if dlopen & dlsym haven't emited one DLClose(Self, Err && Err->empty() ? Err : nullptr); return Sym; } DLErr(Err); return nullptr; }