Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly Export Multi-Value Structs #60

Open
ErikMcClure opened this issue Jun 14, 2020 · 0 comments
Open

Correctly Export Multi-Value Structs #60

ErikMcClure opened this issue Jun 14, 2020 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@ErikMcClure
Copy link
Contributor

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.

@ErikMcClure ErikMcClure added the enhancement New feature or request label Jun 14, 2020
@ErikMcClure ErikMcClure added this to the v0.1.9 milestone Jun 14, 2020
@ErikMcClure ErikMcClure modified the milestones: v0.1.10, v0.2.0 Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant