[Haskell-cafe] Re: Could FFI support pass-by-value of structs?

Maurí­cio briqueabraque at yahoo.com
Wed Jul 1 13:22:36 EDT 2009


> Yeah, I'm not suggesting going via Storable (for all those reasons),
> just extending the FFI to say tuples of FFI types get passed as the
> corresponding C ABI structs. All the magic to match the current platform
> C ABI then lives in the compiler.

Agree. The tuples idea is far better than my first sugestion
on Storable instances.

> I was only half-serious in suggesting this btw, though as far as I can
> see it should actually work. It doesn't help with unions of course and
> it adds complexity to the compiler.

:(

The only known case I have of this beeing important is on GNU GSL,
where the complex functions use a complex type defined as a struct
(with a size 2 array as the only member). This actually just
emulates the 'complex' type of C99, I'm almost sure.

Do you imagine an objection on creating a ticket asking for
something like CComplex on Foreign.C.Types?


Maurício



More information about the Haskell-Cafe mailing list