Re: again: nullForeignPtr

Alastair Reid <[email protected]>
Newsgroups gmane.comp.lang.haskell.ffi
Organization Reid-Hoffmann
Message-ID <[email protected]>
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.