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.
More...
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 dlfcn-win32 on your addon!
Furthermore, this allows the use of Android where the required library is copied to an EXE useable folder.
Example:
...
{
public:
CMyInstance(
KODI_HANDLE instance,
const std::string& kodiVersion);
bool Start();
...
};
CMyInstance::CMyInstance(
KODI_HANDLE instance,
const std::string& kodiVersion)
: CInstanceAudioDecoder(instance, kodiVersion)
{
}
bool CMyInstance::Start()
{
if (!LoadDll(lib)) return false;
Init();
return true;
}
...
void * KODI_HANDLE
Standard undefined pointer handle.
Definition: addon_base.h:199
typedef int(ATTR_APIENTRYP PFN_KODI_ADDON_AUDIODECODER_READ_PCM_V1)(const KODI_ADDON_AUDIODECODER_HDL hdl
Definition: addons/kodi-dev-kit/include/kodi/addon-instance/AudioDecoder.h:437
void(__cdecl *dll_signal(int sig, void(__cdecl *func)(int)))(int)
Definition: emu_msvcrt.cpp:1931
std::string ATTR_DLL_LOCAL GetAddonPath(const std::string &append="")
To get the addon system installation folder.
Definition: kodi-dev-kit/include/kodi/AddonBase.h:658
void(* Cleanup)()
Definition: AESinkFactory.h:32
◆ REGISTER_DLL_SYMBOL
◆ CDllHelper()
kodi::tools::CDllHelper::CDllHelper |
( |
| ) |
|
|
default |
◆ LoadDll()
bool kodi::tools::CDllHelper::LoadDll |
( |
std::string |
path | ) |
|
|
inline |
Function to load requested library.
- Parameters
-
[in] | path | The path with filename of shared library to load |
- Returns
- true if load was successful done
◆ RegisterSymbol()
template<typename T >
bool kodi::tools::CDllHelper::RegisterSymbol |
( |
T & |
functionPtr, |
|
|
const char * |
strFunctionPtr |
|
) |
| |
|
inline |
Function to register requested library symbol.
- Warning
- This function should not be used, use instead the macro REGISTER_DLL_SYMBOL to register the symbol pointer.
Use this always via Macro, e.g.:
◆ ~CDllHelper()
virtual kodi::tools::CDllHelper::~CDllHelper |
( |
| ) |
|
|
inlinevirtual |