[Help] c binding of function that takes callback

I tried your code and it does work, but that basically shifts the problem if I understand this correctly because In the my_interrupt_handler function I cannot access outside functions.

Being able to access global variables is probably enough to solve the problem. I can maybe have a fiber that sleeps and checks if the global variable has changed every second. (although that really feels wrong to do that)

Is there no other way this could be handled more cleanly?
Is there some event-based example in Crystal that I could use?