Closed alexf91 closed 8 months ago
Array types are created as "phony" structs in libffi
and cannot be passed or returned from functions.
This is documented in the libffi
documentation:
Note that arrays cannot be passed or returned by value in C – structure types created like this should only be used to refer to members of real
FFI_TYPE_STRUCT
objects. However, a phony array type like this will not cause any errors from libffi if you use it as an argument or return type. This may be confusing.
They should be disallowed as direct function arguments or return values. This is possible because we have a separate CType.array
type. We could also convert them to pointers if they are used as arguments or return values, but keep the phony struct type when inside a struct.
Errors appear to originate in calls to generated test functions. Regardless of the original source, either the testcase itself or a C++ function, they should be fixed to produce a clean output when all tests succeed.