TSDuck v3.38-3699
MPEG Transport Stream Toolkit
Loading...
Searching...
No Matches
ts::SharedLibrary Class Reference

Shared library handling (.so on Linux, .dylib on macOS, .dll on Windows). More...

#include <tsSharedLibrary.h>

Inheritance diagram for ts::SharedLibrary:

Public Member Functions

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

Protected Member Functions

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

Detailed Description

Shared library handling (.so on Linux, .dylib on macOS, .dll on Windows).

Constructor & Destructor Documentation

◆ SharedLibrary()

ts::SharedLibrary::SharedLibrary ( const fs::path &  filename,
SharedLibraryFlags  flags = SharedLibraryFlags::NONE,
Report report = (ts::NullReport::Instance()) 
)
explicit

Constructor: Load a shared library.

Parameters
[in]filenameShared library file name.
[in]flagsShared library options.
[in,out]reportWhere to report errors.
See also
SharedLibraryFlags

◆ ~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 fs::path & 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 fs::path &  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: