Merge pull request #404 from majaha/patch-2

Change incorrect reference to "above" in ffi.md
pull/410/head
Eric Huss 2 years ago committed by GitHub
commit 1f3e4cd4fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -258,7 +258,7 @@ pub extern "C" fn hello_from_rust() {
# fn main() {} # fn main() {}
``` ```
The `extern "C"` makes this function adhere to the C calling convention, as discussed above in "[Foreign Calling Conventions]". The `extern "C"` makes this function adhere to the C calling convention, as discussed below in "[Foreign Calling Conventions]".
The `no_mangle` attribute turns off Rust's name mangling, so that it has a well defined symbol to link to. The `no_mangle` attribute turns off Rust's name mangling, so that it has a well defined symbol to link to.
Then, to compile Rust code as a shared library that can be called from C, add the following to your `Cargo.toml`: Then, to compile Rust code as a shared library that can be called from C, add the following to your `Cargo.toml`:

Loading…
Cancel
Save