commit
fb6687150c
@ -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 you’re trying these
|
||||
examples yourself, you’ll 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:
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user