PLCnext API Documentation  22.3.0.20
Public Member Functions | Static Public Member Functions | List of all members
Arp::System::Commons::Runtime::SharedLibrary Class Reference

High level API to enable work with dynamically loadable shared libraries. More...

#include <SharedLibrary.hpp>

Public Member Functions

 SharedLibrary (void)
 Constructs an SharedLibrary instance. More...
 
 SharedLibrary (const SharedLibrary &arg)=delete
 Copy contructor. More...
 
SharedLibrary & operator= (const SharedLibrary &arg)=delete
 Assignment operator. More...
 
virtual ~SharedLibrary (void)
 Destructs this instance and frees all resouces. More...
 
void Load (const String &path)
 Loads the specified shared library. More...
 
void Unload (void)
 Unloads the shared library. More...
 
void * GetFunctionAddress (const String &symbolName)
 Returns the address where specified symbol is located in the memory. More...
 

Static Public Member Functions

static String GetArpLibrariesDirectory (void)
 
static String GetFormattedPath (const String &path)
 Formats the path depending on OS. More...
 
static bool ProbeLibrary (const String &path, String &probedPath)
 Probes the library More...
 

Detailed Description

High level API to enable work with dynamically loadable shared libraries.

Constructor & Destructor Documentation

◆ SharedLibrary() [1/2]

Arp::System::Commons::Runtime::SharedLibrary::SharedLibrary ( void  )

Constructs an SharedLibrary instance.

◆ SharedLibrary() [2/2]

Arp::System::Commons::Runtime::SharedLibrary::SharedLibrary ( const SharedLibrary &  arg)
delete

Copy contructor.

◆ ~SharedLibrary()

virtual Arp::System::Commons::Runtime::SharedLibrary::~SharedLibrary ( void  )
virtual

Destructs this instance and frees all resouces.

Member Function Documentation

◆ GetFormattedPath()

static String Arp::System::Commons::Runtime::SharedLibrary::GetFormattedPath ( const String &  path)
static

Formats the path depending on OS.

Parameters
pathPath that shall be formatted.
Returns
Formatted path.

◆ GetFunctionAddress()

void* Arp::System::Commons::Runtime::SharedLibrary::GetFunctionAddress ( const String &  symbolName)

Returns the address where specified symbol is located in the memory.

Parameters
symbolNameName of queried symbol.
Returns
Valid memory address on success, NULL if symbol could not be found.

◆ Load()

void Arp::System::Commons::Runtime::SharedLibrary::Load ( const String &  path)

Loads the specified shared library.

Symbols exposed by the shared library are globally available after a successfull load.

Parameters
pathThe complete path to the library to load.
Exceptions
Arp::Exceptionif the library could not be loaded.

◆ operator=()

SharedLibrary& Arp::System::Commons::Runtime::SharedLibrary::operator= ( const SharedLibrary &  arg)
delete

Assignment operator.

◆ ProbeLibrary()

static bool Arp::System::Commons::Runtime::SharedLibrary::ProbeLibrary ( const String &  path,
String &  probedPath 
)
static

Probes the library

Parameters
pathPath to library
probedPathProbed path to library
Returns
true, if library could be probed. Otherwise false.

◆ Unload()

void Arp::System::Commons::Runtime::SharedLibrary::Unload ( void  )

Unloads the shared library.

Exceptions
Arp::Exceptionin case the unload fails.

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