X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=c-bindings-gen%2FREADME.md;fp=c-bindings-gen%2FREADME.md;h=8377adc4bb8d8427521b603402e2c785fa60b6c4;hb=ee9ceb42b1cbc688e506ed4a5923060dab9713a6;hp=0000000000000000000000000000000000000000;hpb=f2e4f8a2293de3f9a51319d5b42eafc551c158b3;p=rust-lightning diff --git a/c-bindings-gen/README.md b/c-bindings-gen/README.md new file mode 100644 index 00000000..8377adc4 --- /dev/null +++ b/c-bindings-gen/README.md @@ -0,0 +1,14 @@ +LDK C Bindings Generator +======================== + +This program parses a Rust crate's AST from a single lib.rs passed in on stdin and generates a +second crate which is C-callable (and carries appropriate annotations for cbindgen). It is usually +invoked via the `genbindings.sh` script in the top-level directory, which converts the lightning +crate into a single file with a call to +`RUSTC_BOOTSTRAP=1 cargo rustc --profile=check -- -Zunstable-options --pretty=expanded`. + +`genbindings.sh` requires that you have a rustc installed with the `wasm32-wasi` target available +(eg via the `libstd-rust-dev-wasm32` package on Debian or `rustup target add wasm32-wasi` for those +using rustup), cbindgen installed via `cargo install cbindgen` and in your `PATH`, and `clang`, +`clang++`, `gcc`, and `g++` available in your `PATH`. It uses `valgrind` if it is available to test +the generated bindings thoroughly for memory management issues.