YARP
Yet Another Robot Platform
yarp::os::SharedLibrary Class Reference

Low-level wrapper for loading shared libraries (DLLs) and accessing symbols within it. More...

#include <yarp/os/SharedLibrary.h>

Detailed Description

Low-level wrapper for loading shared libraries (DLLs) and accessing symbols within it.

Definition at line 33 of file SharedLibrary.h.

Public Member Functions

 SharedLibrary ()
 Initialize, without opening a shared library yet. More...
 
 SharedLibrary (const char *filename)
 Load the named shared library / DLL. More...
 
 SharedLibrary (const SharedLibrary &)=delete
 
SharedLibraryoperator= (const SharedLibrary &)=delete
 
virtual ~SharedLibrary ()
 Destructor. More...
 
bool open (const char *filename)
 Load the named shared library / DLL. More...
 
bool close ()
 Shared library no longer needed, unload if not in use elsewhere. More...
 
std::string error ()
 Returns a human-readable string describing the most recent error that occurred from a call to one of its functions. More...
 
void * getSymbol (const char *symbolName)
 Look up a symbol in the shared library. More...
 
bool isValid () const
 Check if the shared library is valid. More...
 

Constructor & Destructor Documentation

◆ SharedLibrary() [1/3]

SharedLibrary::SharedLibrary ( )

Initialize, without opening a shared library yet.

Definition at line 57 of file SharedLibrary.cpp.

◆ SharedLibrary() [2/3]

SharedLibrary::SharedLibrary ( const char *  filename)

Load the named shared library / DLL.

Parameters
filenamename of file (see open method)

Definition at line 63 of file SharedLibrary.cpp.

◆ SharedLibrary() [3/3]

yarp::os::SharedLibrary::SharedLibrary ( const SharedLibrary )
delete

◆ ~SharedLibrary()

SharedLibrary::~SharedLibrary ( )
virtual

Destructor.

Will close() if needed.

Definition at line 70 of file SharedLibrary.cpp.

Member Function Documentation

◆ close()

bool SharedLibrary::close ( void  )

Shared library no longer needed, unload if not in use elsewhere.

Returns
true on success

Definition at line 102 of file SharedLibrary.cpp.

◆ error()

std::string SharedLibrary::error ( )

Returns a human-readable string describing the most recent error that occurred from a call to one of its functions.

Returns
the most recent error

Definition at line 122 of file SharedLibrary.cpp.

◆ getSymbol()

void * SharedLibrary::getSymbol ( const char *  symbolName)

Look up a symbol in the shared library.

Definition at line 127 of file SharedLibrary.cpp.

◆ isValid()

bool SharedLibrary::isValid ( ) const

Check if the shared library is valid.

Returns
true iff a valid library has been loaded.

Definition at line 146 of file SharedLibrary.cpp.

◆ open()

bool SharedLibrary::open ( const char *  filename)

Load the named shared library / DLL.

The library is found using the algoithm of ACE::ldfind. Operating-system-specific extensions will be tried, and the relevant path for shared libraries.

Parameters
filenamename of file.
Returns
true on success

Definition at line 77 of file SharedLibrary.cpp.

◆ operator=()

SharedLibrary& yarp::os::SharedLibrary::operator= ( const SharedLibrary )
delete

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