Rollup merge of #29888 - steveklabnik:gh29762, r=sanxiyn

Fixes #29762
This commit is contained in:
Steve Klabnik 2015-11-17 18:13:05 -05:00
commit fb6687150c

View File

@ -8,6 +8,23 @@ foreign code. Rust is currently unable to call directly into a C++ library, but
snappy includes a C interface (documented in
[`snappy-c.h`](https://github.com/google/snappy/blob/master/snappy-c.h)).
## A note about libc
Many of these examples use [the `libc` crate][libc], which provides various
type definitions for C types, among other things. If youre trying these
examples yourself, youll need to add `libc` to your `Cargo.toml`:
```toml
[dependencies]
libc = "0.2.0"
```
[libc]: https://crates.io/crates/libc
and add `extern crate libc;` to your crate root.
## Calling foreign functions
The following is a minimal example of calling a foreign function which will
compile if snappy is installed: