I made a start on writing an FFI howto at:
http://www.reid-consulting-uk.ltd.uk/docs/ffi.html
It is very rough, doesn't answer your specific question, has many
typos and omissions, etc. but some of the links in the Tips and Tricks
section (section 4) might help.
To answer your question
From: Antony Courtney [mailto:[EMAIL PROTECTED]]
While the FFI spec. is excellent, I'd really like to see a companion
document with real examples of how to use the FFI for the
easy, obvious
kinds of library interfacing tasks that are likely to arise
in practice.
There are quite a
Alastair Reid [EMAIL PROTECTED] wrote,
RC 7 of the FFI Addendum is now available from
In adding mallocForeignPtr and friends to Hugs, I found that I needed
the address of free to pass as a parameter.
There's no suitable way to generate free from MarshalAlloc.free (the
obvious use of a
RC 7 of the FFI Addendum is now available from
In adding mallocForeignPtr and friends to Hugs, I found
that I needed
the address of free to pass as a parameter.
There's no suitable way to generate free from
MarshalAlloc.free (the
obvious use of a Haskell wrapper would break
... maybe I'm being stupid, but I don't see what the problem is.
Why can't mallocForeignPtr be implemented as:
mallocForeignPtrBytes size = do
r - c_malloc (fromIntegral size)
newForeignPtr r ptr_c_free
foreign import ccall unsafe malloc
c_malloc :: CInt - Ptr a