1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-03-20 14:31:15 +02:00

Add speaker notes to interop with C slides ()

Part of .
This commit is contained in:
Martin Geisler 2024-12-16 22:53:54 +01:00 committed by GitHub
parent 2bae363d16
commit 64bd331314
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 26 additions and 0 deletions
src/android

@ -8,3 +8,15 @@ that you can:
When you call functions in a foreign language we say that you're using a
_foreign function interface_, also known as FFI.
<details>
- This is a key ability of Rust: compiled code becomes indistinguishable from
compiled C or C++ code.
- Technically, we say that Rust can be compiled to the same [ABI] (application
binary interface) as C code.
</details>
[ABI]: https://en.wikipedia.org/wiki/Application_binary_interface

@ -24,3 +24,17 @@ We already saw this in the
> production.
We will look at better options next.
<details>
- The [`"C"` part][extern-abi] of the `extern` block tells Rust that `abs` can
be called using the C [ABI] (application binary interface).
- The `safe fn abs` part tells that Rust that `abs` is a safe function. By
default, extern functions are considered unsafe, but since `abs(x)` is valid
for any `x`, we can declare it safe.
</details>
[extern-abi]: https://doc.rust-lang.org/reference/items/external-blocks.html#abi
[ABI]: https://en.wikipedia.org/wiki/Application_binary_interface