@@ -1631,14 +1631,41 @@ the Rust ABI and the foreign ABI.
16311631A number of [ attributes] ( #ffi-attributes ) control the behavior of external blocks.
16321632
16331633By default external blocks assume that the library they are calling uses the
1634- standard C "cdecl" ABI. Other ABIs may be specified using an ` abi ` string, as
1635- shown here:
1634+ standard C ABI on the specific platform . Other ABIs may be specified using an
1635+ ` abi ` string, as shown here:
16361636
16371637``` ignore
16381638// Interface to the Windows API
16391639extern "stdcall" { }
16401640```
16411641
1642+ There are three ABI strings which are cross-platform, and which all compilers
1643+ are guaranteed to support:
1644+
1645+ * ` extern "Rust" ` -- The default ABI when you write a normal ` fn foo() ` in any
1646+ Rust code.
1647+ * ` extern "C" ` -- This is the same as ` extern fn foo() ` ; whatever the default
1648+ your C compiler supports.
1649+ * ` extern "system" ` -- Usually the same as ` extern "C" ` , except on Win32, in
1650+ which case it's ` "stdcall" ` , or what you should use to link to the Windows API
1651+ itself
1652+
1653+ There are also some platform-specific ABI strings:
1654+
1655+ * ` extern "cdecl" ` -- The default for x86\_ 32 C code.
1656+ * ` extern "stdcall" ` -- The default for the Win32 API on x86\_ 32.
1657+ * ` extern "win64" ` -- The default for C code on x86\_ 64 Windows.
1658+ * ` extern "aapcs" ` -- The default for ARM.
1659+ * ` extern "fastcall" `
1660+ * ` extern "vectorcall" `
1661+
1662+ Finally, there are some rustc-specific ABI strings:
1663+
1664+ * ` extern "rust-intrinsic" ` -- The ABI of rustc intrinsics.
1665+ * ` extern "rust-call" ` -- The ABI of the Fn::call trait functions.
1666+ * ` extern "platform-intrinsic" ` -- Specific platform intrinsics -- like, for
1667+ example, ` sqrt ` -- have this ABI. You should never have to deal with it.
1668+
16421669The ` link ` attribute allows the name of the library to be specified. When
16431670specified the compiler will attempt to link against the native library of the
16441671specified name.
0 commit comments