You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/ffi.md
+12-13Lines changed: 12 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ snappy includes a C interface (documented in
11
11
## A note about libc
12
12
13
13
Many of these examples use [the `libc` crate][libc], which provides various
14
-
type definitions for C types, among other things. If you’re trying these
14
+
type definitions for C types, among other things. If you’re trying out these
15
15
examples yourself, you’ll need to add `libc` to your `Cargo.toml`:
16
16
17
17
```toml
@@ -23,9 +23,8 @@ libc = "0.2.0"
23
23
24
24
## Prepare the build script
25
25
26
-
Because [snappy](https://github.com/google/snappy) is a static library by default.
27
-
So there is no C++ std linked in the output artifact.
28
-
In order to use this foreign library in Rust, we have to manually specify that we want to link stdc++ in our project.
26
+
Because [snappy](https://github.com/google/snappy) is a static library by default, so there is no stdc++ linked in the output artifact.
27
+
In order to use this foreign library in Rust, we have to manually specify that we want to link stdc++ std to our project.
29
28
The easiest way to do this is by setting up a build script.
30
29
31
30
First edit `Cargo.toml`, inside `package` add `build = "build.rs"`:
@@ -39,7 +38,7 @@ Then create a new file at the root of your workspace, named `build.rs`:
39
38
```rust
40
39
// build.rs
41
40
fnmain() {
42
-
println!("cargo:rustc-link-lib=dylib=stdc++"); // This line may be unnecessary for some environment.
41
+
println!("cargo:rustc-link-lib=dylib=stdc++"); // This line may be unnecessary for some environments.
0 commit comments