[Haskell-cafe] How can I pass IOUArrays to FFI functions?
Ryan Ingram
ryani.spam at gmail.com
Tue Aug 21 02:47:06 EDT 2007
> Your code is broken in a most evil and insidious way.
Interesting. This is for a toy project, so I'm not too worried, but lets
say I wanted to do this "correctly" and I was set on using IOUArray for some
reason. (The Haskell wiki claims that StorableArray is slower; is that
actually the case?)
Which of the following fixes would work now? Which has the lowest
probability of not working in the future?
1) Declare f to take Addr# and don't construct a Ptr Word32
I suspect this would be enough unless the GC changed to some sort of
continous GC which can happen even without an allocation
2) Declare f to take MutableByteArray#
Is this good enough to make the collector happy?
3) Something else I haven't thought of?
If there was no other option, and StorableArray wasn't slower, and I was
working on a real project, I'd probably wrap my own around ForeignPtr like
Data.ByteString.
-- ryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070820/f950e47b/attachment.htm
More information about the Haskell-Cafe
mailing list