互操作性
Rust 对于与其他编程语言的互操作性有着出色的支持。这意味着您可以:
- 从其他语言调用 Rust 函数。
- 从 Rust 调用用其他语言编写的函数。
当您从外部语言调用函数时,我们称之为使用 外部函数接口(Foreign Function Interface, FFI)。
-
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.