This repository contains codes for learning to build FFI APIs in Rust for C++ and C#.
There is only one memory leak in this library.
The cause of this leak is the println
macro, which is called in the function print_rust
.
More details in the following link: rust-lang/rust#19776.
cargo build
cbindgen --config cbindgen.toml --crate ffiapi --output include/ffiapi.h
export LD_LIBRARY_PATH=/home/breno/Documents/Workspace/Projects/rust_for_cpp/target/debug:$LD_LIBRARY_PATH
g++ --std=c++11 -o target/test examples/test.cpp -Ltarget/debug/ -lffiapi
or
g++ --std=c++11 -o target/test examples/test.cpp target/debug/libffiapi.so
reset && cargo build && cbindgen --config cbindgen.toml --crate ffiapi --output include/ffiapi.h && g++ --std=c++11 -o target/test examples/test.cpp -Ltarget/debug/ -lffiapi && valgrind ./target/test
reset && cargo build && dotnet run
This project is licensed under the MIT License - see the LICENSE file for details.