> 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.


FFI mailing list

Reply via email to