YARP  2.3.68+272-20170522.1+git50f0ae7
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>

Public Member Functions

 SharedLibrary ()
 Initialize, without opening a shared library yet. More...
 
 SharedLibrary (const char *filename)
 Load the named shared library / DLL. More...
 
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...
 
ConstString 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...
 

Private Member Functions

 SharedLibrary (const SharedLibrary &)
 
SharedLibraryoperator= (const SharedLibrary &)
 

Private Attributes

yarp::os::impl::SharedLibraryImpl *const implementation
 

Detailed Description

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

Definition at line 27 of file SharedLibrary.h.

Constructor & Destructor Documentation

◆ SharedLibrary() [1/3]

SharedLibrary::SharedLibrary ( )

Initialize, without opening a shared library yet.

Definition at line 50 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 56 of file SharedLibrary.cpp.

◆ ~SharedLibrary()

SharedLibrary::~SharedLibrary ( )
virtual

Destructor.

Will close() if needed.

Definition at line 63 of file SharedLibrary.cpp.

◆ SharedLibrary() [3/3]

yarp::os::SharedLibrary::SharedLibrary ( const SharedLibrary )
private

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 95 of file SharedLibrary.cpp.

◆ error()

ConstString 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 115 of file SharedLibrary.cpp.

◆ getSymbol()

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

Look up a symbol in the shared library.

Definition at line 120 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 139 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 70 of file SharedLibrary.cpp.

◆ operator=()

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

Member Data Documentation

◆ implementation

yarp::os::impl::SharedLibraryImpl* const yarp::os::SharedLibrary::implementation
private

Definition at line 84 of file SharedLibrary.h.


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