gforth
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gforth] GForth callbacks


From: Rene Hartmann
Subject: [gforth] GForth callbacks
Date: Sun, 3 Sep 2017 12:00:31 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]