StackOverflowException gpio callback lgGpioSetAlertsFunc error


I am writing an lgpio library glpio-GPIO that uses a callback function called lgGpioSetAlertsFun (lgGpio.

The exact error is ‘An exception of class StackOverflowException was not handled. The application must shut down.’

Setting up the GPIO is with the following code in the Opening event:

The code runs, and when I raise the voltage to 3.3v, the cbf function is to fire, and then the StackOverslowException error occurs.

Is there any helpful hints to stop the StackOverflowException error?

Thanks a bunch

If the callback originates from gpio interupt then you almost certainly cannot talk to ListBox in the callback. (Or any Xojo object or string)

1 Like

Thank you Bjorn.

Check out DeclareCallbackMBS class in MBS Xojo Plugins, which provides thread safe callbacks.