binding tool for C libs

Jacob Carlborg doob at me.com
Mon Jan 23 06:32:10 PST 2012


On 2012-01-23 14:15, Gour wrote:
> On Sun, 22 Jan 2012 22:03:08 +0400
> Denis Shelomovskij<verylonglogin.reg at gmail.com>  wrote:
>
>> I'm finishing a fast (I just don't see a faster way) and garbage-free
>> CTFE-capable wrapper. But it requires IDL to be written for every C
>> function.
>
> I'm curious if you have read the following paper:
>
> http://www.cse.unsw.edu.au/~chak/papers/Cha99b.html
>
> describing C2Hs tool used to provide bindings for C libraries for
> Haskell?
>
>  From the abstract: "The tool obtains information about the C data type
> definitions and function signatures by analysing the C header files of
> the library. It uses this information to compute the missing details in
> the template of a Haskell module that implements a Haskell binding to
> the C library. Hooks embedded in the binding file signal where, which,
> and how C objects are accessed from Haskell. The Haskell code in the
> binding file determines Haskell type signatures and marshaling details.
> The approach is lightweight and does not require an extra interface
> description language."

I think the best idea is to create a tool that generates bindings using 
Clang. That's also what I'm slowly working on.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list