[Haskell-beginners] Question about CFloat and Float
ch.gosch at googlemail.com
Thu Apr 28 14:27:22 CEST 2011
Dear list members,
I have the following problem: I have wrapped a C library using the FFI and
The C functions all take a bunch of pointers to C arrays of floats, doubles,
or ints as arguments.
Naturally, the Haskell representation of these is e.g.
or, for single values, CFloat.
My question is: if I have an array, e.g. allocated with mallocArray, to
Haskell Float values (Ptr Float),
is the representation of Float exactly the same as for CFloat? Can I safely
use Ptr Float where the C function
expects the C type float* ?
I assume that I can not, and in that case I would like to find a way to have
Float on the Haskell side and CFloat on the C side.
Any hint on how I would do that without copying data and without too large
Thanks a lot,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners