GForth callbacks

Rene Hartmann <[email protected]>
Newsgroups gmane.comp.lang.forth.gforth
Message-ID <[email protected]>
I'm trying to use the C callbacks available with GForth 0.7.9 but 
somehow it doesn't seem to work.

I have a callback that takes two arguments and one return value.

I define it like this:


c-callback cs-renderer n a -- a

' render>buf cs-renderer CONSTANT c_render_to_buf


When passing c_render_to_buf to the function which requires the callback 
the callback gets invoked but when it returns things go wrong.

If I place a .s in the callback it prints <-34288843> so it seems the 
stack isn't set up properly. But I don't know what to do different to 
make it work.

I've yet to create a complete example I can post.

--
René Hartmann
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.