-
Notifications
You must be signed in to change notification settings - Fork 312
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
Other calling conventions #979
base: master
Are you sure you want to change the base?
Conversation
Here's a godbolt with the generated headers (test cconv.rs): https://godbolt.org/z/MqPhhzqcf There are a few compile errors which I intentionally left in (like requesting sysv64 on clang/gcc non-x86_64). I can change that behavior so a compile error is never emitted and a warning is instead if that's preferred. |
Realized I had a misunderstanding about what the extern_decl flag was doing (toggling |
Documented the configuration option added for this feature. Should be ready to merge :) |
Calling convention predefines are now emitted in a defined order, should actually be ready to merge. |
This PR adds support for other calling conventions as discussed in #55 and #718. It adds an ABI field (instead of just an extern field) to
Function
s and adds a concept ofPredefines
which right now only contains the compiler/platform-specific#defines
needed to make the calling conventions work nicely but may be useful in the future for other cases where something needs to look at all the code, then conditionally emit some lines at the top of the file.This use case is very important to my work to adopt Rust for UEFI/firmware programming, since cbindgen is needed to integrate Rust into existing C codebases easily. Most of these environments define an explicit calling convention, which we need to be able to export from Rust code for interoperability.