How can i use clion to call c/c++ code from rust. i want to build a project in which i have to call some c/c++ functions from rust. i have configured rust in clion.
You need two things:
- Call c/c++ build system from
cargo
and link resulted file to rust code - Describe c/c++ functions and types on Rust to call them as ordinary rust functions
To do 1
you can use cc
or cmake
crates, cmake
crate usage you can see for example
here: https://github.com/servo/skia
To do 2
you can use bindgen
crate.
1 Like