tree: 9a9b0ee7801d3e659e3956a58f0789d8cf00bb9d [path history] [tgz]
  1. Cargo.toml
  2. cmdline.rs
  3. lib.rs
  4. main.rs
  5. README.md
cc_bindings_from_rs/README.md

cc_bindings_from_rs

Disclaimer: This project is experimental, under heavy development, and should not be used yet.

Invoking as a standalone executable

Most rustc cmdline parameters should be supported (e.g. --crate-type).

Example:

# Set CARGO_TARGET_DIR to avoid generating build artifacts inside of the source
# tree (i.e. generate them elsewhere - where `hg status` cannot see them).
$ export CARGO_TARGET_DIR=$HOME/scratch/cargo-target

$ cat $HOME/scratch/test.rs
pub fn public_function() {
    private_function()
}

fn private_function() {}

$ cargo run -- \
    --h_out=$HOME/scratch/test.h -- \
    $HOME/scratch/test.rs --crate-type=lib --sysroot `rustc --print sysroot`

$ cat $HOME/scratch/test.h
// Public functions: public_function

Contributing

See rs_bindings_from_cc/README.md.