> Granted. And remember we already have a (quite ugly) module CString!
> So here is a new proposal:
>
> * Deprecate the old definitions in CString and add
>
> type CString = Ptr CChar
> mallocCString :: String -> IO CString
> peekCString :: CString -> IO String
> pokeCString :: CString -> String -> IO ()
> withCString :: String -> (CString -> IO a) -> IO a
> newCString :: String -> IO CString
>
> * Add a new module CStringLen with
>
> type CStringLen = (CString, Int)
> mallocCStringLen :: String -> IO CStringLen
> peekCStringLen :: CStringLen -> IO String
> pokeCStringLen :: CStringLen -> String -> IO ()
> withCStringLen :: String -> (CStringLen -> IO a) -> IO a
> newCStringLen :: String -> IO CStringLen
Ok. I'm still using the existing CString, but it can be renamed to
something else. I've been using "UnsafeCString" since these ByteArray
CStrings can only be passed to unsafe foreign functions. For now, let's
just rename CString to UnsafeCString and change all the uses.
Cheers,
Simon
_______________________________________________
FFI mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/ffi