This repo showcases using C++ code inside rust, using python as an intermediary. This is obviously the best way to do this.
source build.sh
Here are the lines for build.sh
:
c++ -O3 -Wall -std=c++17 -fPIC -shared -o src/cppmodulelib.so src/cppmodule.cpp
cp src/*.so .
cargo build
cargo run
, if the outputted .so
library isn't in the directory being used to run the rust binary - it won't work.