[Haskell-cafe] Re: "C" buffer suggestions??
agl at imperialviolet.org
Mon Jun 23 17:00:34 EDT 2008
On Mon, Jun 23, 2008 at 1:15 PM, Galchin, Vasili <vigalchin at gmail.com> wrote:
> I tried to write a test value of Word8 without success. Can you give an example?
I'm not quite sure what you would want in such an example. See  for
the malloc function. Then you take the result and wrap it with :
fp <- mallocBytes nbytes >>= newForeignPtr finalizerFree
When you want to use it, use  to unwrap fp and get a raw Ptr Word8.
You can pass these to foreign functions any place they expect a
uint8_t *, char * etc.
Adam Langley agl at imperialviolet.org http://www.imperialviolet.org
More information about the Haskell-Cafe