Best way to interface with C/C++?

Hi, I am looking at manners to interface with C. At the moment I am using a simple label = function-name scheme, but I would like to automatically generate simple bindings.

I have looked at gccxml and swig, both seem to involve a lot of hacking. Is there anyone with any experience in this field who would like to share his/her experience?

Oh yeah, the language I am building is a simple statically typed ML variant with type constructor classes.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Reppy's work


Thanks, great articles, they pointed me in the direction of the C->Haskell work. Maybe I'll go with that in the future. (I decided to stick with what I have now and see whether I can build a generator from .h files in the, I guess far, future.)


as seen (somewhat buried) previously on LtU. only note that (took me a while to realize) it is only compiled, there is no REPL tool. and i'm not sure what the debugging deal is. and i never quite got it really building and working for me on my machine, iirc.

Inline C

One way is to allow inline C inside your language, which works most easily (only?) if your language compiles to C.

Alien Goo seems to be the most straightforward such system, other languages, such as Gambit-C have similar capabilities.