Skip to content

Correctly Export Multi-Value Structs #60

@ErikMcClure

Description

@ErikMcClure

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions