Re: lightweight struct handling in FFI?

2002-09-19 Thread Alastair Reid
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

RE: lightweight struct handling in FFI?

2002-09-19 Thread Simon Marlow
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

Re: ANN: H98 FFI Addendum 1.0, Release Candidate 7

2002-09-19 Thread Manuel M T Chakravarty
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

RE: ANN: H98 FFI Addendum 1.0, Release Candidate 7

2002-09-19 Thread Simon Marlow
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

Re: ANN: H98 FFI Addendum 1.0, Release Candidate 7

2002-09-19 Thread Alastair Reid
... 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