Re: FFI Ptr question

2003-07-03 Thread paul
On Thu, Jul 03, 2003 at 01:40:46AM -0400, Derek Elkins wrote: On Thu, 3 Jul 2003 11:34:08 +0800 [EMAIL PROTECTED] wrote: If a C function returns a (void*), let's say: data MyObj = MyObj foreign import ccall static myobj_ffi.h new_obj newMyObject :: IO (Ptr MyObj) ptr -

Re: FFI Ptr question

2003-07-03 Thread Derek Elkins
On Thu, 3 Jul 2003 15:04:26 +0800 [EMAIL PROTECTED] wrote: On Thu, Jul 03, 2003 at 01:40:46AM -0400, Derek Elkins wrote: On Thu, 3 Jul 2003 11:34:08 +0800 [EMAIL PROTECTED] wrote: If a C function returns a (void*), let's say: data MyObj = MyObj foreign import ccall static

Re: FFI Ptr question

2003-07-03 Thread Alastair Reid
[EMAIL PROTECTED] wrote: If a C function returns a (void*), let's say: data MyObj = MyObj foreign import ccall static myobj_ffi.h new_obj newMyObject :: IO (Ptr MyObj) ptr - newMyObject should I free the ptr afterwards or not? There's no single right answer to this - it all depends

Re: FFI Ptr question

2003-07-03 Thread Sven Panne
[EMAIL PROTECTED] wrote: So am I right to draw a picture like this? [...] Basically, yes. Or from the Haskell implementation's view: I don't have a clue what a Ptr really is, but it fits in C's void*. [ 1. 2. ] The requirement for matching allocators and deallocators is not much different

Re: FFI Ptr question

2003-07-02 Thread Derek Elkins
On Thu, 3 Jul 2003 11:34:08 +0800 [EMAIL PROTECTED] wrote: If a C function returns a (void*), let's say: data MyObj = MyObj foreign import ccall static myobj_ffi.h new_obj newMyObject :: IO (Ptr MyObj) ptr - newMyObject should I free the ptr afterwards or not? Assuming that it