Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches

Addon creation macro
This export the three mandatory "C" functions to have available for Kodi.

Addon creation macro
This export the three mandatory "C" functions to have available for Kodi.

Note
Only this macro can be used on a C++ addon, everything else is done automatically.
Parameters
[in]AddonClassUsed addon class to be exported with CAddonBase as parent.

Example:

#include <kodi/AddonBash.h>
class CMyAddon : public kodi::addon::CAddonBase
{
public:
CMyAddon() = default;
ADDON_STATUS Create() override;
};
ADDON_STATUS CMyAddon::Create()
{
// Some work
}
ADDONCREATOR(CMyAddon)
Definition kodi-dev-kit/include/kodi/AddonBase.h:583
ADDON_STATUS
Definition addon_base.h:138
@ ADDON_STATUS_OK
For everything OK and no error.
Definition addon_base.h:140
virtual ADDON_STATUS Create()
Main addon creation function.
Definition kodi-dev-kit/include/kodi/AddonBase.h:625
#define ADDONCREATOR(AddonClass)
Definition kodi-dev-kit/include/kodi/AddonBase.h:1855

As information, the following functions are exported using this macro:

Function Use Description
ADDON_Create(KODI_HANDLE addonInterface) required Addon creation call.
Like an int main() is this the first on addon called place on his start and create within C++ API related class inside addon.
Parameters
[in]addonInterfaceHandle pointer to get Kodi's given table. There have addon needed values and functions to Kodi and addon must set his functions there for Kodi.
[in]globalApiVersionThis gives the main version ADDON_GLOBAL_VERSION_MAIN where currently on Kodi's side.
This is unused on addon as there's also other special callback functions for.
Only thought for future use if needed earlier.
[in]unusedThis is a not used value, only there to have in case of need no Major API version increase where break current.
Returns
ADDON_STATUS_OK if correct, for possible errors see ADDON_STATUS.
const char* ADDON_GetTypeVersion(int type) required Ask addon about version of given type.
This is used to query its associated version in the addon before work is carried out in it and the Kodi can adapt to it.
Parameters
[in]typeWith ADDON_TYPE defined type to ask.
Returns
Version as string of asked type.
const char* ADDON_GetTypeMinVersion(int type) optional Ask addon about minimal version of given type.
This is used to query its associated min version in the addon before work is carried out in it and the Kodi can adapt to it.
Note
The minimum version is optional, if it were not available, the major version is used instead.
Parameters
[in]typeWith ADDON_TYPE defined type to ask.
Returns
Min version as string of asked type.