The add
function is defined in
Lines 2 to 5 in ab0354e
The c++ code has a extern block which links to the rust function
Line 3 in ab0354e
The main function from c++ calls add on numbers 14
and 17
Lines 6 to 8 in ab0354e
- Build the cdylib
cargo build
- compile c++ demo
g++ demo.cpp ./target/debug/libdemo.so
- Run
./a.out