[C2hs] Binding to Libdb, FunPtrs

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sat Apr 22 20:44:37 EDT 2006

On Sun, 2006-04-23 at 00:43 +0200, Udo Stenzel wrote:
> Hello,
> I'd like to use c2hs to create a binding for Sleepy Cat's LibDB.
> However, some difficulties crop up:
> - variadic functions.  I realize I can't call them anyway, and I don't
>   need to (they are just for primitive error reporting).  But there are
>   pointers to variadic functions in some structures, and I need c2hs to
>   parse them and correctly calculate offsets.
> - lots of FunPtrs.  The whole API is defined as structures with FunPtrs
>   inside.  c2hs will happily create get hooks for them, but won't
>   generate the foreign import "dynamic" declarations.
> - defines.  Am I right in assuming that c2hs does not recognize
>   #define'd constant and so cannot reflect them in Haskell?
> I'm willing to dive into the code and fix this, I just want to make sure
> I don't (clumsily) duplicate any effort.  As for the FunPtrs inside
> structs, I'm thinking of a new hook that combines a get hook and a fun
> (or call) hook.  Does anyone have a better idea?

Sounds good. Feel free to discuss these issues on this list and send in
any darcs patches you make for review.

Manuel may well have some comments on the issues you've brought up but
he's often quite busy so you may like to start discussing/hacking the
least controversial bits.


More information about the C2hs mailing list