Skip to content

Commit

Permalink
Merge #197
Browse files Browse the repository at this point in the history
197: use_core() is required for #![no_std] compatible generated bindings r=therealprof a=david-perez



Co-authored-by: david-perez <hallaplay835@gmail.com>
  • Loading branch information
bors[bot] and david-perez committed Jul 16, 2019
2 parents b229e8e + 8b72c1e commit ff334e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/interoperability/c-with-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ Rather than manually generating these interfaces, which may be tedious and error
2. Write a `bindings.h` file, which `#include "..."`'s each of the files you gathered in step one
3. Feed this `bindings.h` file, along with any compilation flags used to compile
your code into `bindgen`. Tip: use `Builder.ctypes_prefix("cty")` /
`--ctypes-prefix=cty` to make the generated code `#![no_std]` compatible.
4. `bindgen` will produce the generated Rust code to the output of the terminal window. This file may be piped to a file in your project, such as `bindings.rs`. You may use this file in your Rust project to interact with C/C++ code compiled and linked as an external library
`--ctypes-prefix=cty` and `Builder.use_core()` to make the generated code `#![no_std]` compatible.
4. `bindgen` will produce the generated Rust code to the output of the terminal window. This file may be piped to a file in your project, such as `bindings.rs`. You may use this file in your Rust project to interact with C/C++ code compiled and linked as an external library. Tip: don't forget to use the [`cty`](https://crates.io/crates/cty) crate if your types in the generated bindings are prefixed with `cty`.

[bindgen]: https://github.com/rust-lang-nursery/rust-bindgen
[bindgen user's manual]: https://rust-lang.github.io/rust-bindgen/
Expand Down

0 comments on commit ff334e7

Please sign in to comment.