-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Currently, all multi-value structs are simply returned by-value in the LLVM IR, but no C ABI actually allows this. Most C ABIs have some sort of hidden parameter that gets prepended to the parameter list which contains a pointer to a struct allocated from the caller. In some ABIs, like Microsoft's ABI, a struct that is less than 64-bits skips this and simply casts the entire struct to a 64-bit integer which is then returned.
inNative used to wrap exported functions in __cdecl functions, but defaulted to making all functions __cdecl to make certain operations easier. This behavior needs to be restored and the generated wrapper function must properly generate a compliant C ABI function for multi-value return, which may also require reversing the order of the return values in the struct so they are intuitive, as right now they are laid out in reverse order.