Open
Description
.NET currently supports passing/returning structs according to hardware floating-point calling convention up to 16 bytes for reasons stated in #107286 (comment)
Native ABI does not limit size of FP structs so this won't work:
struct Empty {}
struct S { double; Empty; long; }
[DllImport("SomeLib")]
public static extern void func(S s);
.NET will pass S according to integer calling convention (by implicit reference) and the native side will expect it in two registers, fa0 and a0.
Such structs are acheivable via empty structs, which are undefined in C, which ABI .NET interops follow. However, it would be nice to throw an exception if FP structs > 16 bytes appear in interops. (Things like struct { _Alignas(16) double; long; }
are legal in C and .NET users may use empty structs to match the layout.)
Metadata
Metadata
Assignees
Type
Projects
Status
No status