again: nullForeignPtr
Alastair Reid
alastair at reid-hoffmann.net
Tue Jul 8 09:53:44 EDT 2003
> The need for nullForeignPtr arises when a function expects
> a pointer to some data structure or a null pointer. In this case I cannot
> make the foreign import have the type (Maybe (ForeignPtr ()) since it's not
> accepted by the FFI.
I guess I've mostly used this trick with GreenCard whcih supports this idiom
quite well.
Mind you, ForeignPtr isn't accepted by the FFI either so the code you
currently use to marshall them could be modified to marshall Maybe
(ForeignPtr ()) instead.
--
Alastair
More information about the FFI
mailing list