Kodi Documentation 18.0
Kodi is an open source media player and entertainment hub.
CDllHelper Class Reference

Class to help with load of shared library functions. More...

#include <DllHelper.h>

Public Member Functions

 CDllHelper ()
 
virtual ~CDllHelper ()
 
bool LoadDll (const std::string &path)
 Function to load requested library. More...
 
template<typename T >
bool RegisterSymbol (T &functionPtr, const char *strFunctionPtr)
 Function to register requested library symbol. More...
 

Detailed Description

Class to help with load of shared library functions.

You can add them as parent to your class and to help with load of shared library functions.

Note
To use on Windows must you also include p8-platform on your addon!

Example:

...
class CMyInstance : public kodi::addon::CInstanceAudioDecoder,
private CDllHelper
{
public:
CMyInstance(KODI_HANDLE instance);
bool Start();
...
/* The pointers for on shared library exported functions *&zwj;/
int (*Init)();
void (*Cleanup)();
int (*GetLength)();
};
CMyInstance::CMyInstance(KODI_HANDLE instance)
: CInstanceAudioDecoder(instance)
{
}
bool CMyInstance::Start()
{
std::string lib = kodi::GetAddonPath("myLib.so");
if (!LoadDll(lib)) return false;
if (!REGISTER_DLL_SYMBOL(Init)) return false;
if (!REGISTER_DLL_SYMBOL(Cleanup)) return false;
if (!REGISTER_DLL_SYMBOL(GetLength)) return false;
Init();
return true;
}
...
void * KODI_HANDLE
Standard undefined pointer handle.
Definition: AddonBase.h:69
Class to help with load of shared library functions.
Definition: DllHelper.h:74
Definition: addons/kodi-addon-dev-kit/include/kodi/addon-instance/AudioDecoder.h:67

Constructor & Destructor Documentation

◆ CDllHelper()

CDllHelper::CDllHelper ( )
inline

◆ ~CDllHelper()

virtual CDllHelper::~CDllHelper ( )
inlinevirtual

Member Function Documentation

◆ LoadDll()

bool CDllHelper::LoadDll ( const std::string &  path)
inline

Function to load requested library.

Parameters
[in]pathThe path with filename of shared library to load
Returns
true if load was successful done

◆ RegisterSymbol()

template<typename T >
bool CDllHelper::RegisterSymbol ( T &  functionPtr,
const char *  strFunctionPtr 
)
inline

Function to register requested library symbol.

Note
This function should not be used, use instead the macro REGISTER_DLL_SYMBOL to register the symbol pointer.

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