Skip to content

Commit

Permalink
auto merge of #15421 : catharsis/rust/doc-ffi-minor-fixes, r=alexcric…
Browse files Browse the repository at this point in the history
…hton

Signed-off-by: Anton Lofgren <alofgren@op5.com>
  • Loading branch information
bors committed Jul 15, 2014
2 parents d336c1a + e737440 commit 1704ebb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/doc/guide-ffi.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ the same stack as the rust stack. This means that there is no extra
stack-switching mechanism in place because it is assumed that the large stack
for the rust task is plenty for the C function to have.

A planned future improvement (net yet implemented at the time of this writing)
A planned future improvement (not yet implemented at the time of this writing)
is to have a guard page at the end of every rust stack. No rust function will
hit this guard page (due to Rust's usage of LLVM's `__morestack`). The intention
for this unmapped page is to prevent infinite recursion in C from overflowing
Expand Down Expand Up @@ -201,7 +201,7 @@ It is possible to pass functions defined in Rust to an external library.
The requirement for this is that the callback function is marked as `extern`
with the correct calling convention to make it callable from C code.

The callback function that can then be sent to through a registration call
The callback function can then be sent through a registration call
to the C library and afterwards be invoked from there.

A basic example is:
Expand Down Expand Up @@ -243,14 +243,14 @@ void trigger_callback() {
}
~~~~
In this example will Rust's `main()` will call `do_callback()` in C,
which would call back to `callback()` in Rust.
In this example Rust's `main()` will call `do_callback()` in C,
which would, in turn, call back to `callback()` in Rust.
## Targetting callbacks to Rust objects
## Targeting callbacks to Rust objects
The former example showed how a global function can be called from C code.
However it is often desired that the callback is targetted to a special
However it is often desired that the callback is targeted to a special
Rust object. This could be the object that represents the wrapper for the
respective C object.
Expand Down Expand Up @@ -334,7 +334,7 @@ it is also absolutely necessary that no more callbacks are performed by the
C library after the respective Rust object gets destroyed.
This can be achieved by unregistering the callback in the object's
destructor and designing the library in a way that guarantees that no
callback will be performed after unregistration.
callback will be performed after deregistration.
# Linking
Expand Down

0 comments on commit 1704ebb

Please sign in to comment.