Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
redox-os
cbindgen
Commits
2bf0ca27
Commit
2bf0ca27
authored
Apr 17, 2017
by
Ryan Hunt
Browse files
Update the README for build script instructions
parent
e76b2570
Changes
1
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
2bf0ca27
...
...
@@ -11,8 +11,31 @@ This project can be used to generate C bindings for Rust code. It is currently b
## Use
### Command line
`cbindgen crate/ crate/bindings.h`
See
`cbindgen --help`
for more options.
### `build.rs`
`cbindgen`
can also be used in build scripts. How this fits into compiling the native code depends on your project.
Here's an example build.rs script:
```
rust
extern
crate
cbindgen
;
use
cbindgen
::{
Config
,
Library
};
fn
main
()
{
let
config
=
Config
::
default
();
Library
::
load
(
"../build-script"
,
&
config
)
.build
(
&
config
)
.unwrap
()
.write_to_file
(
&
config
,
"bindings.h"
);
}
```
## Examples
See
`examples/`
for some examples of rust source that can be handled.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment