On Mar 21, 2012, at 4:35 AM, Yves Parès wrote:
> Hello,
>
> I have to interact with a C++ library that accepts as string types (putting
> c++ strings aside) pointers of wchar_t (CWString in Haskell) or unsigned
> 32-bit int (Ptr Word32 for UTF-32 codepoints).
The vector package has "storable" vectors, which are essentially raw C arrays.
It provides the function:
Data.Vector.Storable.unsafeWith :: Storable a => Vector a -> (Ptr a ->
IO b) -> IO b
This is probably the simplest way to do what you're describing. You can also
manually allocate and poke data into raw memory using Foreign.Marshall.Alloc
and Foreign.Storable, if you're feeling particularly masochistic ;)
-- James
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe