[ocaml-ctypes] Stack allocated structs ?

Jeremy Yallop yallop at gmail.com
Thu Dec 12 18:44:16 GMT 2013


On 12 December 2013 18:20, Daniel Bünzli <daniel.buenzli at erratique.ch> wrote:
> Is returning stack allocated structs unsupported ? When I try to do this I get this exception:
>
> Fatal error: exception Static.Unsupported("libffi does not support passing arrays")
>
> (the struct has a single field with an array 16 uint8_t))

There's some support for returning stack-allocated structs, but (as
you've discovered) that doesn't include array members for the moment.
This is another thing that'll certainly improve once we have stub
generation.

It might be possible to add the missing support before that, though,
if it's safe to assume that a struct with a member of type T[n] is
passed in the same way as a struct with n members of type T.  I've
added an issue as a reminder to investigate:

https://github.com/ocamllabs/ocaml-ctypes/issues/113


More information about the Ctypes mailing list