Init()

Updated: October 26, 2022

Synopsis:

#include <aoi.h>

int32_t (*Init)(const AOICtrl_t *interfaces);

Arguments:

interfaces
A pointer to a control structure for the interfaces defined in the addon.

Description:

This function should initialize the DLL. This could involve:
  • Setting global variables
  • Returning an error to cause the DLL to be unloaded immediately and the calling function (e.g., AoHold()) that loaded the library to also return an error. The DLL would do this for consistency with all other cases where a DLL-loading function returns an error. For instance, if it finds there's no AOI interface list inside or we run out of memory, the function should always try to restore everything to the previous state before it was called, which includes unloading the DLL.
  • Calling AoHold() on itself to prevent the DLL from ever getting unloaded (i.e., to keep it in memory permanently)

Returns:

0 if successful, -1 if an error occurred.