Trying to get some c callbacks working and encountering some strange behavior...

c-library genericCallback
    \c void genericCallback(void (*tocall)(void))
    \c {
    \c    tocall();
    \c }
    c-function genericCallback genericCallback a -- void
    c-callback blankCallback -- void
end-c-library


:noname   .s s" 1 2 + ." evaluate ; blankCallback genericCallback


That produces

<-21965655376>
uncaught exception: Stack underflow


I initially thought to have the signature of genericCallback be func
-- void, but swig kept calling them addresses instead. Also it
produced the same result.

Looking at the generated wrapper code, I see that a new stackpointers
variable is created and used. It seems that whatever stack checking is
happening isn't taking this into account, coming to some incorrect
conclusions instead.

I came across this trying to evaluate input in glutIdleFunc so that I
could keep making changes while the program is running. Any advice on
how to make this use case work, that doesn't involve "just don't use
glut" (I'd love to be able to take it...)?

Thanks.

Reply via email to