[Haskell-cafe] FFI and struct arguments
felipe.lessa at gmail.com
Thu Jul 17 12:32:54 EDT 2008
On Thu, Jul 17, 2008 at 12:08 PM, kyra <kyrab at mail.ru> wrote:
> Yes, but programmer *knows* the structure layout, so she usually can emulate
> it with a sequence of primary ffi type arguments. It's pretty trivial for
> the original example (see my previous post on this subj) and can be extended
> further. For example, in my homebrew COM library I pretty successfully
> marshall 16-byte Variants *by value* by means of two consecutive "legal"
> Word64 arguments.
I am concerned, however, with the portability of the library. I mean,
is the calling convention for both
void func(vect v);
void func(float x, float y);
the same on x86? On x86-64? On Windows? On Linux? I guess it would be
a lot faster to pass the arguments on the stack than alloca'ting,
copying to the new area and then copying from the area to the stack,
but I don't want to sacrifice the portability.
More information about the Haskell-Cafe