You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This updates the definitions of the extern ABIs to try to make them a
little clearer as to what they mean.
This also adds new statements about the equivalence of some ABIs
to the "C" ABI.
* `unsafeextern"system"` ---Usuallythesameas `extern"C"`, exceptonWin32, inwhichcaseit's `"stdcall"`, orwhatyoushoulduse to link to the WindowsAPI itself.
> AsthecorrectunderlyingABIonWindowsistarget-specific, it'sbesttouse `extern "system"` when attempting to link WindowsAPI functions that don't otherwise use a different ABI.
128
131
129
132
r[items.extern.abi.unwind]
130
133
* `extern "C-unwind"` and `extern "system-unwind"` ---Identical to `"C"` and `"system"`, respectively, but with [different behavior][unwind-behavior] when the callee unwinds (by panicking or throwing a C++ style exception).
There are also some platform-specific ABI strings:
134
137
135
138
r[items.extern.abi.cdecl]
136
-
* `unsafeextern "cdecl"` ---Thedefault for x86_32 C code.
139
+
* `unsafeextern "cdecl"` ---Thecalling convention typically used with x86_32 C code.
137
140
*Only available on x86_32 targets.
138
141
142
+
> [!NOTE]
143
+
> See <https://learn.microsoft.com/en-us/cpp/cpp/cdecl> and <https://en.wikipedia.org/wiki/X86_calling_conventions#cdecl> for more information.
144
+
139
145
r[items.extern.abi.stdcall]
140
-
* `unsafeextern "stdcall"` ---Thedefault forthe Win32API on x86_32.
146
+
* `unsafeextern "stdcall"` ---Thecalling convention typically used by the [Win32API] on x86_32.
141
147
*Only available on x86_32 targets.
142
148
149
+
> [!NOTE]
150
+
> See <https://learn.microsoft.com/en-us/cpp/cpp/stdcall> and <https://en.wikipedia.org/wiki/X86_calling_conventions#stdcall> for more information.
151
+
143
152
r[items.extern.abi.win64]
144
-
* `unsafeextern "win64"` ---Thedefault forC code on x86_64 Windows.
153
+
* `unsafeextern "win64"` ---TheWindows x64 ABI.
145
154
*Only available on x86_64 targets.
155
+
* "win64" is the same as the "C" ABI on Windows x86_64 targets.
156
+
157
+
> [!NOTE]
158
+
> See <https://learn.microsoft.com/en-us/cpp/build/x64-software-conventions> and <https://en.wikipedia.org/wiki/X86_calling_conventions#Microsoft_x64_calling_convention> for more information.
146
159
147
160
r[items.extern.abi.sysv64]
148
-
* `unsafeextern "sysv64"` ---Thedefault forC code on non-Windows x86_64.
161
+
* `unsafeextern "sysv64"` ---TheSystemVABI.
149
162
*Only available on x86_64 targets.
163
+
* "sysv64" is the same as the "C" ABI on non-Windows x86_64 targets.
164
+
165
+
> [!NOTE]
166
+
> See <https://wiki.osdev.org/System_V_ABI> or <https://en.wikipedia.org/wiki/X86_calling_conventions#System_V_AMD64_ABI> for more information.
* "aapcs" is the same as the "C" ABI on soft-float ARM32.
172
+
173
+
> [!NOTE]
174
+
> See [ArmProcedureCallStandard](https://developer.arm.com/documentation/107656/0101/Getting-started-with-Armv8-M-based-systems/Procedure-Call-Standard-for-Arm-Architecture--AAPCS-) for more information.
154
175
155
176
r[items.extern.abi.fastcall]
156
177
* `unsafeextern "fastcall"` ---The `fastcall` ABI--- corresponds to MSVC's `__fastcall` and GCC and clang's `__attribute__((fastcall))`.
157
178
*Only available on x86_32 targets.
158
179
180
+
> [!NOTE]
181
+
> See <https://learn.microsoft.com/en-us/cpp/cpp/fastcall> and <https://en.wikipedia.org/wiki/X86_calling_conventions#Microsoft_fastcall> for more information.
182
+
159
183
r[items.extern.abi.thiscall]
160
-
* `unsafeextern "thiscall"` ---Thedefault forC++ member functions on x86_32 MSVC--- corresponds to MSVC's `__thiscall` and GCC and clang's `__attribute__((thiscall))`.
184
+
* `unsafeextern "thiscall"` ---Thecalling convention typically used on C++ class member functions on x86_32 MSVC--- corresponds to MSVC's `__thiscall` and GCC and clang's `__attribute__((thiscall))`.
161
185
*Only available on x86_32 targets.
162
186
187
+
> [!NOTE]
188
+
> See <https://en.wikipedia.org/wiki/X86_calling_conventions#thiscall> and <https://learn.microsoft.com/en-us/cpp/cpp/thiscall> for more information.
189
+
163
190
r[items.extern.abi.efiapi]
164
191
* `unsafeextern "efiapi"` ---TheABI used for [UEFI] functions.
165
192
*Only available on x86 and ARM targets (32bit and 64bit).
@@ -494,4 +521,5 @@ restrictions as [regular function parameters].
0 commit comments