> So at the moment you're using using Storable and a Haskell record, say:
>
> data AIOCB = AIOCB {
>    ...
>  }
>
> and we're suggesting instead:
>
> newtype AIOCB = AIOCB (ForeignPtr AIOCB)


      ^^^ I am somewhat new to Haskell. Not a total newbie! But what exactly
does the above mean? Are the three references of "AIOCB" in different
namespaces? If it too much trouble to explain, can you point me at Haskell
URL to read?


>
>
> then to access a member use hsc2hs:
>
> getBlah :: AIOCB -> IO Blah
> getBlah (AIOCB fptr) =
>  withForeignPtr fptr $ \ptr -> {# peek aiocb,blah #} ptr
>
> So you only access the parts you need and keep the aiocb C struct
> allocated on the heap (use mallocForeignPtr).
>
> Duncan
>
>
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to