-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Add a platform-dependent calling convention alias #8774
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
Comments
You can currently use |
Merged
alexcrichton
added a commit
to alexcrichton/rust
that referenced
this issue
Nov 8, 2013
This adds an other ABI option which allows a custom selection over the target architecture and OS. The only current candidate for this change is that kernel32 on win32 uses stdcall, but on win64 it uses the cdecl calling convention. Otherwise everywhere else this is defined as using the Cdecl calling convention. cc rust-lang#10049 Closes rust-lang#8774
bors
added a commit
that referenced
this issue
Nov 9, 2013
This adds an other ABI option which allows a custom selection over the target architecture and OS. The only current candidate for this change is that kernel32 on win32 uses stdcall, but on win64 it uses the cdecl calling convention. Otherwise everywhere else this is defined as using the Cdecl calling convention. cc #10049 Closes #8774
bors
added a commit
that referenced
this issue
Nov 9, 2013
This adds an other ABI option which allows a custom selection over the target architecture and OS. The only current candidate for this change is that kernel32 on win32 uses stdcall, but on win64 it uses the cdecl calling convention. Otherwise everywhere else this is defined as using the Cdecl calling convention. cc #10049 Closes #8774
flip1995
pushed a commit
to flip1995/rust
that referenced
this issue
Jun 30, 2022
try reading rust-version from Cargo.toml Cargo.toml can contain a field `rust-version`, that acts like a MSRV of clippy.toml file: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field This will try to read that field and use it, if the clippy.toml config has no `msrv` entry changelog: respect `rust-version` from `Cargo.toml` closes rust-lang#8746 closes rust-lang#7765
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Some cross-platform libraries use different calling conventions on different platform. For example, OpenGL uses cdecl on *nix, and stdcall on Windows. Writing wrappers for these libraries is currently troublesome, as it requires special-casing the calling convention in Rust code.
I propose adding an ABI alias called "system" which could be used in extern declarations, in place of "stdcall", "cdecl", etc. It would map to whichever calling convention is default on the specific platform.
Thus one could say, e.g.:
Rather than:
The text was updated successfully, but these errors were encountered: