namespace fedem::dso {
    class DSOLoader;
}

Defined in <dso/DSOLoader.hh>. Link dsold.

DSOLoader cannot be constructed — every constructor, the destructor and assignment are = delete. It is a set of static functions over one static std::mutex and one process-wide handle set.

Static member functions

FunctionPage
load( soName ), load( soName, dirs )DSOLoader::load
loadAll( ext ), loadAll( ext, folder ), loadAll( ext, dirs )DSOLoader::loadAll, ::loadAllByEnvironment
loadAllByEnvironment( ext ), loadAllByEnvironment( ext, env )DSOLoader::loadAll, ::loadAllByEnvironment
prefix( pre ), prefix()DSOLoader::prefix
loadSigned(...), loadVerified(...) — with DSOLD_WITH_SIGNDSOLoader::loadSigned, ::loadVerified

Behaviour common to all load paths

  • dlopen flags: RTLD_GLOBAL | RTLD_LAZY. Global scope makes the host's catalog symbol and one plugin's symbols visible to the next; lazy binding defers relocations.
  • Handle lifetime: each successful dlopen handle is stored in a file-local std::set; the set's destructor dlcloses them all at process exit. There is no public unload.
  • Idempotent: re-loading a file returns the same handle (dlopen reference-counts) and re-runs nothing.
  • Locking: every call takes the static std::mutex — concurrent loads are serialised.
  • Static initialisers run on load — this is when a plugin's REGISTER objects populate the catalog.

Signed overloads

loadSigned and loadVerified exist only when dsold was built with plugin-sign (the CMake build defines DSOLD_WITH_SIGN). Without it the class has just the plain load functions. See loadSigned / loadVerified.

Minimal use

#include <dso/DSOLoader.hh>
using fedem::dso::DSOLoader;

DSOLoader::prefix( "lib" );
DSOLoader::loadAll( ".so", "/opt/app/plugins" );