ANN: bindings-DSL 1.0.14
FFI package bindings-DSL provides a language to describe foreign interfaces on top of hsc2hs. http://bitbucket.org/mauricio/bindings-dsl http://hackage.haskell.org/package/bindings-DSL 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> #stoptype 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. Best, Maurício
2011/9/1 Maurício CA <mauricio.antunes@gmail.com>:
New to this release is that you can get pointers to all declared fields of a structure.
Nice work Maurício! I'm already using it in my usb library: https://github.com/basvandijk/usb/blob/master/System/USB/Base.hs#L1926 Thanks, Bas
participants (2)
-
Bas van Dijk -
Maurício CA