[Haskell-cafe] FFI Query: How to free a CString allocated in Haskell
Verma Anurag-VNF673
Anurag.Verma at motorola.com
Mon Apr 28 08:11:51 EDT 2008
Hi,
I am calling a Haskell function from my C code, wherein I export a
Haskell function xyz that takes as an argument string and returns a
string:
Foreign export ccall xyz::CString -> IO CString
xyz = do
-- extract the input string and act on it--
-- at the end I return a string like this
newCString str
Now once I call this function from C code, I am freeing the allocated
memory using free function. I want to confirm that this is the right
thing to do.
- Anurag
More information about the Haskell-Cafe
mailing list