TSDuck Version 3.15-955 (TSDuck - The MPEG Transport Stream Toolkit)
ts::SharedLibrary Class Reference

Shared library handling (.so on UNIX, DLL on Windows). More...

Inheritance diagram for ts::SharedLibrary:

Public Member Functions

 SharedLibrary (const UString &filename, bool permanent=false, Report &report=(*ts::NullReport::Instance()))
 Constructor: Load a shared library. More...
 
virtual ~SharedLibrary ()
 Destructor. More...
 
const UStringerrorMessage () const
 Return a message describing the constructor error. More...
 
const UStringfileName () const
 Return actual file name of shared library. More...
 
void * getSymbol (const std::string &name) const
 Get the value of an exported symbol inside the shared library. More...
 
bool isLoaded () const
 Check if the library was successfully loaded. More...
 

Protected Member Functions

void load (const UString &filename)
 Try to load an alternate file if the shared library is not yet loaded. More...
 
void unload ()
 Force unload, even if permanent.
 

Detailed Description

Shared library handling (.so on UNIX, DLL on Windows).

Constructor & Destructor Documentation

◆ SharedLibrary()

ts::SharedLibrary::SharedLibrary ( const UString filename,
bool  permanent = false,
Report report = (*ts::NullReport::Instance()) 
)
explicit

Constructor: Load a shared library.

Parameters
[in]filenameShared library file name.
[in]permanentIf false (the default), the shared library is unloaded from the current process when this object is destroyed. If true, the shared library remains active.
[in,out]reportWhere to report errors.

◆ ~SharedLibrary()

virtual ts::SharedLibrary::~SharedLibrary ( )
virtual

Destructor.

Unload the shared library if permanent was false.

Member Function Documentation

◆ isLoaded()

bool ts::SharedLibrary::isLoaded ( ) const
inline

Check if the library was successfully loaded.

Returns
True if the library was successfully loaded.

◆ errorMessage()

const UString& ts::SharedLibrary::errorMessage ( ) const
inline

Return a message describing the constructor error.

Useful when isLoaded() == false.

Returns
An error message.

◆ fileName()

const UString& ts::SharedLibrary::fileName ( ) const
inline

Return actual file name of shared library.

Returns
The actual file name of shared library.

◆ getSymbol()

void* ts::SharedLibrary::getSymbol ( const std::string &  name) const

Get the value of an exported symbol inside the shared library.

Parameters
[in]nameSymbol name, using 8-bit characters, not Unicode.
Returns
The symbol value or 0 on error. When the symbol is an address, the returned value is a virtual memory address inside the current process.

◆ load()

void ts::SharedLibrary::load ( const UString filename)
protected

Try to load an alternate file if the shared library is not yet loaded.

Parameters
[in]filenameShared library file name.

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