From: | Gene <gene.ressler@gmail.com> |
Newsgroups: | comp.compilers |
Date: | Wed, 22 Jul 2009 21:08:36 -0700 (PDT) |
Organization: | Compilers Central |
References: | 09-07-074 |
Keywords: | code |
Posted-Date: | 24 Jul 2009 18:29:18 EDT |
On Jul 21, 3:09 am, Christoffer Lernv <le...@dragonascendant.com>
wrote:
> I'd like to research FFI in various languages, basically to find the
> best FFI-solution and copy from that one.
> It's likely that I will restrict myself to interfacing with C, so if
> there are elegant solutions integrating with C, and more clunky but
> flexible that are more general, I probably prefer the ones that
> exclusively target C.
>
> What I'm looking for is syntax, to what extent automatic conversion of
> arguments are done, how to handle callbacks, memory management, how to
> create structured data (i.e. structs in the case of C) etc.
>
> /Christoffer
> [Someone asked roughly the same question in 1997, but got no answers. Poking
> around on the net, all the FFI seems rather ad-hoc and language specific.-John]
I've looked at quite a few. John is right. Because of the double
dependence on source and target languages and runtime environments, ad
hoc is an understatement. There is very little commonality. I think
the least worst approach is to define a distinct glue language and
process that into C code that provides clean interfaces. Perl does
this, though IMO there is much room to improve the approach. Think
also about the other direction: Calls from a foreign language program
into code written in yours.
Gene
Return to the
comp.compilers page.
Search the
comp.compilers archives again.