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?

If I have another imported C function:

foreign import ccall "static myobj_ffi.h print_obj" printMyObject :: Ptr MyObj -> IO ()

Can I safely assume the C function print_obj(void *) always get the
same pointer even if I call (printMyObject ptr) multiple times?

Any hints is greatly appreciated!

Regards,
.paul.
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to