[Haskell] ANN: bindings-DSL 1.0.14

Maurício CA mauricio.antunes at gmail.com
Thu Sep 1 18:10:44 CEST 2011

FFI package bindings-DSL provides a language to describe foreign
interfaces on top of hsc2hs.


New to this release is that you can get pointers to all declared fields
of a structure. Suppose you have the following struct in C:

   struct a {
      int b;
      struct {
         char c;
         float d;
      } e;
      struct a *f;

You write this in your .hsc file:

   #starttype struct a
   #field b , CInt
   #field e.c , CChar
   #field e.d , CFloat
   #field f , Ptr <a>

Besides the usual Storable instantiated Haskell version of struct a,
(named C'a), now you also get the following:

   p'a'b :: Ptr C'a -> Ptr CInt
   p'a'e'c :: Ptr C'a -> Ptr CChar
   p'a'e'd :: Ptr C'a -> Ptr CFloat
   p'a'f :: Ptr C'a -> Ptr (Ptr C'a)

Hope it's useful to you.


More information about the Haskell mailing list