FFI Bug - Finalizer always called with NULL pointer?

Simon Marlow simonmarhaskell at gmail.com
Mon Apr 10 05:54:34 EDT 2006


Brian Hulley wrote:
> Solved!
> By just using the following syntax, GHC compiles everything correctly:
> 
> foreign import ccall
>         "&duma_releaseFont"  -- absolutely vital for FunPtr functions
>         duma_releaseFont
>         :: FunPtr (Ptr RawFont -> IO ())

Yes, you're not the first person to trip over this one.  I've done it 
myself, and it caused much head-scratching.

I think we should probably emit a warning in this case - it's much more 
likely that you meant to import "&foo" as a FunPtr, than just "foo".

Cheers,
	Simon


More information about the Glasgow-haskell-users mailing list