Skip to content

FFI guide fixes #17187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 13, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/doc/guide-ffi.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ A basic example is:
Rust code:

~~~~no_run
extern fn callback(a:i32) {
extern fn callback(a: i32) {
println!("I'm called from C with value {0}", a);
}

Expand Down Expand Up @@ -243,7 +243,7 @@ void trigger_callback() {
}
~~~~

In this example Rust's `main()` will call `do_callback()` in C,
In this example Rust's `main()` will call `trigger_callback()` in C,
which would, in turn, call back to `callback()` in Rust.


Expand All @@ -269,7 +269,7 @@ struct RustObject {
// other members
}

extern "C" fn callback(target: *mut RustObject, a:i32) {
extern "C" fn callback(target: *mut RustObject, a: i32) {
println!("I'm called from C with value {0}", a);
unsafe {
// Update the value in RustObject with the value received from the callback
Expand Down