Re: Callbacks in gforth-0.6.9-20080716
  Home FAQ Contact Sign in
comp.lang.forth only
 
Advanced search
POPULAR GROUPS

more...

 Up
Re: Callbacks in gforth-0.6.9-20080716         

Group: comp.lang.forth · Group Profile
Author: Anton Ertl
Date: Sep 18, 2008 13:20

ddaa gmail.com> writes:
>Hello, I have trouble making callbacks work in gforth-0.6.9-20080716.
>
>So far, I can use libcc to build both the callback and the caller
>function, and use them in gforth. But I cannot make the final step to
>lib.fs callbacks. Apparently, I'm not passing the callback right to
>the C code.
>
>The system is an Ubuntu 8.04, with my self-made package of gforth, out
>of combining the existing package and the gforth-0.6.9-20080716
>upstream ("make check" passes). By the way, I'd be glad to give it to
>anyone who could help make it land in Debian.
>
>Can anyone (yes, Anton, I'm looking at you) help me make it work?

Actually, Bernd is the guy who knows about the callbacks (and I was
busy). And with the latest changes he has just committed, this
example seems to work nicely, whether I use libffi.fs or fflib.fs.
This is on a Linux-AMD64 box:

foreign-test
xxxx.fs:26:<3> 46912513935352 2 2
into_callback abba87f8 2 2
foreign_plus 2 2
returning 4
4
xxxx.fs:27:<0>
forth-test
xxxx.fs:31:<3> 5944960 2 2
into_callback 5ab680 2 2

Testing callback
arguments: <5> 5944960 2 2 2 2
result <4> 5944960 2 2 4
returning 4
4
xxxx.fs:32:<0>

I did not test your code from the other posting (my newsreader does
not decode quoted-printable).

- anton
no comments
diggit! del.icio.us! reddit!