Member of fedem::dso::DSOLoader.
static void load( std::string const& soName ); // (1)
static void load( std::string const& soName,
std::vector<std::string> const& list ); // (2)
- Passes
soNamestraight todlopen. An absolute or relative path is used as-is; a bare soname goes throughRPATH/LD_LIBRARY_PATH/ the default search path. - Tries
list[0]/soName,list[1]/soName, … in order, stopping at the first that loads. If none load, throws.
Both call dlopen with RTLD_GLOBAL | RTLD_LAZY, record the handle in the process-wide set, and run the DSO's static initialisers (which fire its REGISTER objects).
Parameters
| Name | Description |
|---|---|
soName | File name or path of the shared object. |
list | Directories to try as prefixes for soName. |
Return value
void. Success is "did not throw".
Exceptions
fedem::exception::FileNotFound — (1) dlopen failed; (2) no directory in list produced a loadable file. what() / whatStr() includes the name tried; missingFilename() and reason() (the dlerror() text) are available on the exception object.
Examples
DSOLoader::load( "./libCircle.so" ); // explicit relative path
DSOLoader::load( "libCircle.so" ); // RPATH / LD_LIBRARY_PATH
DSOLoader::load( "libCircle.so",
{ "/opt/app/plugins",
"/usr/lib/app/plugins" } ); // first hit wins
try {
DSOLoader::load( "libCodec_flac.so", codecDirs );
} catch( fedem::exception::FileNotFound const& e ) {
log().warn( "codec unavailable: {} ({})", e.missingFilename(), e.reason() );
}
Notes
- Loading the same path twice is a cheap no-op after the first time.
- The filename prefix does not apply to
load— only toloadAll/loadAllByEnvironment. - To also get a trust decision, use
loadSigned/loadVerified.

