-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Variadic functions don't allow "system" on non-x86 Windows #110505
Comments
cc #97971 which originally added variadics support to some other calling conventions (though not |
A workaround is to use "C" on non-x86 as I implemented here: microsoft/windows-rs#2458 |
@wesleywiser @nagisa Thoughts on permitting variadic parameters with the |
This work-around is causing pain. Would be great if there was a way that it could be avoided. :) |
There's a comment saying this can't work: rust/compiler/rustc_target/src/spec/abi/mod.rs Lines 70 to 78 in ef7ebaa
I don't understand anything about these ABIs so I can't say how accurate this is. Also I see nothing here special-casing x86, so why does the issue specifically mention non-x86? |
Happy to update |
Can we make |
Went ahead and opened #119587 for this. |
Rollup merge of rust-lang#119587 - beepster4096:system_varargs, r=petrochenkov Varargs support for system ABI This PR allows functions with the `system` ABI to be variadic (under the `extended_varargs_abi_support` feature tracked in rust-lang#100189). On x86 windows, the `system` ABI is equivalent to `C` for variadic functions. On other platforms, `system` is already equivalent to `C`. Fixes rust-lang#110505
While testing variadic function support with
raw-dylib
I discovered that Rust requires such functions to use either "C" or "cdecl" ABIs butraw-dylib
requires the "system" ABI on non-x86 Windows.My undertstanding from discussing with @dpaoliello is that this is not an issue with
raw-dylib
itself but with Rust's insistence that such functions aren't allowed to use the "system" ABI. It's just thatraw-dylib
is very strict about calling convention so that's where the issue surfaced.On x64 I should be able to compile this but Rust says no:
This example works if I change the ABI to "cdecl" but that's not meant to be a valid ABI on x64 and so when I try to compile this with
raw-dylib
it fails:The practical result is that it is impossible to link this function with
raw-dylib
on non-x86.The text was updated successfully, but these errors were encountered: