David Lo writes: > Anyone has ever tried exporting Haskell list to C array?
Check out the module Foreign.Marshal.Array, specifically the functions: withArray :: Storable a => [a] -> (Ptr a -> IO b) -> IO b withArrayLen :: Storable a => [a] -> (Int -> Ptr a -> IO b) -> IO b These will marshal a Haskell list into a C array and hand the pointer to the given function. Because the array is gone when your function returns, you don't need to worry about freeing resources, catching exceptions, etc. If you need more fine-grained control, you'll find the module also has functions equivalent to the usual malloc/free way of doing things. Peter _______________________________________________ Glasgow-haskell-users mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/glasgow-haskell-users