Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
PLMD::DLLoader Class Reference

#include <DLLoader.h>

Classes

class  EnsureGlobalDLOpen
 RAII helper for promoting RTLD_LOCAL loaded objects to RTLD_GLOBAL. More...
 

Public Member Functions

 DLLoader ()
 Default constructor. More...
 
 ~DLLoader ()
 Cleanup. More...
 
const std::vector< void * > & getHandles () const noexcept
 
void * load (const std::string &)
 Load a library, returning its handle. More...
 

Static Public Member Functions

static bool installed ()
 Returns true if the dynamic loader is available (on some systems it may not). More...
 
static bool isPlumedGlobal ()
 Returns true if a PLUMED library is available in the global namespace. More...
 

Private Member Functions

 DLLoader (const DLLoader &)=delete
 Deleted copy constructor. More...
 
DLLoaderoperator= (const DLLoader &)=delete
 Deleted assignment. More...
 

Private Attributes

std::vector< void * > handles
 

Detailed Description

Class taking care of dynamic loading. It contains wrappers to the dlopen() routine. It is designed so that when an object of this class goes out of scope all the libraries loaded by it are unloaded. In this manner, loaded libraries are automatically unloaded at the end of execution. Libraries are loaded with RTDL_LOCAL option, which means that they are not accessible from outside. Still, if they contain self-registering classes, they will register themselves to the ActionRegister object.

Constructor & Destructor Documentation

◆ DLLoader() [1/2]

PLMD::DLLoader::DLLoader ( const DLLoader )
privatedelete

Deleted copy constructor.

◆ DLLoader() [2/2]

PLMD::DLLoader::DLLoader ( )

Default constructor.

◆ ~DLLoader()

PLMD::DLLoader::~DLLoader ( )

Cleanup.

Member Function Documentation

◆ getHandles()

const std::vector< void * > & PLMD::DLLoader::getHandles ( ) const
noexcept

◆ installed()

bool PLMD::DLLoader::installed ( )
static

Returns true if the dynamic loader is available (on some systems it may not).

◆ isPlumedGlobal()

bool PLMD::DLLoader::isPlumedGlobal ( )
static

Returns true if a PLUMED library is available in the global namespace.

It does so by looking for the presence of the C interface. It will detect any kernel that is available in the global namespece, not just the one from which this call is issued. This is useful to detect possible conflicts in advance.

◆ load()

void * PLMD::DLLoader::load ( const std::string &  s)

Load a library, returning its handle.

◆ operator=()

DLLoader& PLMD::DLLoader::operator= ( const DLLoader )
privatedelete

Deleted assignment.

Member Data Documentation

◆ handles

std::vector<void*> PLMD::DLLoader::handles
private

The documentation for this class was generated from the following files: