I try to implement a Soft Declare function from a c lib which use a callback function,
but I don’t know how to setup the callback function correct to work in Xojo.
#IF TargetARM AND TargetLinux then
Soft Declare Function gpioSetSignalFunc Lib “libpigpio.so” (signum as UInt , “callback function”) As Integer
Return gpioSetSignalFunc(signum, “callback function”)
#Endif
The original c function declaration is :
int gpioSetSignalFunc(unsigned signum, gpioSignalFunc_t f)
Registers a function to be called (a callback) when a signal occurs.
signum: 0-63
f: the callback function
Returns 0 if OK, otherwise PI_BAD_SIGNUM.
The function is passed the signal number.
One function may be registered per signal.
The callback may be cancelled by passing NULL.
By default all signals are treated as fatal and cause the library to call gpioTerminate and then exit.