Skip to content

Use extern "system" instead of "stdcall" in example #1854

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

Merged
merged 1 commit into from
Jun 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/items/external-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ standard C ABI on the specific platform. Other ABIs may be specified using an
`abi` string, as shown here:

```rust
# #[cfg(any(windows, target_arch = "x86"))]
// Interface to the Windows API
unsafe extern "stdcall" { }
unsafe extern "system" { }
Comment on lines 106 to +107
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now doesn't seem to quite match with the comment above about being for a Windows API (the example was intended to show an example of specifically doing something on Windows, with the prior expectation that stdcall was a windows thing). Maybe we should just drop the comment?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, "system" is what you should always use for the Windows API. Using stdcall would be wrong because it'll break on non-x86 platforms (well, not currently but that's the plan for the future).

I definitely don't want us to be recommending a future compatibility hazard in official docs. I'd be ok with also removing the comment but I do think it's still correct.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, ok, seems like I misunderstood. Thanks!

```

r[items.extern.abi.standard]
Expand Down