Help: writing ffi bindings to a C library

Ronald Legere
Wed, 21 May 2003 12:31:46 -0700 (PDT)

Agreeing with David, but I like to use 
 types rather than (). YOu can do this because,
in ghc, you can write:
data Blah
with no rhs, and it is understood to be an 'opaque'
type.  Ghc beleives any claims you make about
passing Ptr Blah back and forth to C  in your foreign
import declarations <* Grin *>.

As for passing structures back and forth, and
accessing the components, you can do it from Haskell
or from the "c-side"... I can send you a sample of
doing it from haskell if you wish.


--- David Roundy <> wrote:
> On Wed, May 21, 2003 at 04:27:10PM +0100, Bayley,
> Alistair wrote:

> > construct a Ptr a? What type should "a" be?).
> Unless you actually need to ever access their
> contents, I'd just define the
> pointers to be of type Ptr (), essentially like a
> void * pointer in C.  No
> need to use Storable if they are only ever accessed
> through C functions
> (which I would hope would be the case).
> --

Ronald Legere

Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.