From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/doc/book/redirects/ffi.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 src/doc/book/redirects/ffi.md (limited to 'src/doc/book/redirects/ffi.md') diff --git a/src/doc/book/redirects/ffi.md b/src/doc/book/redirects/ffi.md new file mode 100644 index 000000000..20ed3963e --- /dev/null +++ b/src/doc/book/redirects/ffi.md @@ -0,0 +1,23 @@ +% FFI + +There is a new edition of the book and this is an old link. + +> Sometimes, your Rust code may need to interact with code written in another language. +> To do this, Rust has a keyword, `extern`, that facilitates creating and using a _Foreign Function Interface_ (FFI). + +```rust +extern "C" { + fn abs(input: i32) -> i32; +} + +fn main() { + unsafe { + println!("Absolute value of -3 according to C: {}", abs(-3)); + } +} +``` + +--- + +You can find the latest version of this information +[here](ch19-01-unsafe-rust.html#using-extern-functions-to-call-external-code) \ No newline at end of file -- cgit v1.2.3