need help with ffi function pointers

David Sankel camio at yahoo.com
Sun Mar 2 00:19:40 EST 2003


Hello,

  I'm working on interfacing a c library that has the
notion of callbacks.

I have a C function:

f_setCallback( void (funptr*) () );

I would like to allow a haskell developer to have an
interface like the following:

callback :: IO ()
callback = putStr "Called!\n"

main :: IO ()
main = do
  setCallback callback
  -- etc.

Is this possible via. ffi?  If so, how would I do it
code wise?

Thanks,

David J. Sankel



More information about the FFI mailing list