FFI woes - (Was [Shootout-list] Directions of various benchmarks)

Einar Karttunen ekarttun@cs.helsinki.fi
Wed, 18 May 2005 16:52:14 +0300


This is getting a little bit off-topic...

skaller <skaller@users.sourceforge.net> writes:
> So I'm claiming 1 LOC for problem 1, and 2 LOC for problem 2
> and NO language that can't read C headers can possibly beat that.

And many languages have tools which read C headers and generate the
interfacing code for complex things. 

> The final challenge is much harder: a Gtk GUI function with
> a callback/client data argument .. Felix has a tool 'flxcc'
> that will detect this automatically and generate the required
> bindings including the conversion of a Felix closure object
> to a C function pointer/void *client_data pair .. but the actual
> interface code is quite messy and long winded (20 lines at least).
> At least some of it begs for a language extension to simplify it:)

It is usually quite simply to get a function that can be called from
C. Making the RTS work nicely is much more complex. Things like how does
the RTS handle callbacks to the host language from C in a multithreaded
environment. How is blocking implemented if the thread models of C and
the host language vary? 

- Einar Karttunen