Converting [Word8] to CString
Fri, 14 Sep 2001 23:40:42 -0700
I'm looking for a function that will convert a [Word8] byte-array to a
CString (i.e. a C byte array) for the purposes of FFI.
foreign import "JVMBridge" "JVMBridge_FindClass" rawFindClass ::
JavaVM -> CString -> IO JVMObjectRef;
makeCString :: [Word8] -> IO CString;
It has to work correctly with _any_ list of bytes. And it has to be the
_same_ list of bytes that comes through on the native side.
Note that we are only dealing with bytes here, this has nothing whatever
to "characters", "text", "charsets", "Unicode", "encodings" or any of
If this really can't be done, is there another type I can use? In some
cases, the external function may call back into Haskell.
Ashley Yakeley, Seattle WA