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

#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()))
virtual ~SharedLibrary ()
const UString & errorMessage () const
const fs::path & fileName () const
void * getSymbol (const std::string &name) const
bool isLoaded () const

Protected Member Functions

void load (const fs::path &filename)
void unload ()

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.

◆ unload()

void ts::SharedLibrary::unload ( )
protected

Force unload, even if permanent


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