https://github.com/davideuler/rust-lib-via-cpp
Demo to call rust library in cpp project
https://github.com/davideuler/rust-lib-via-cpp
Last synced: 9 months ago
JSON representation
Demo to call rust library in cpp project
- Host: GitHub
- URL: https://github.com/davideuler/rust-lib-via-cpp
- Owner: davideuler
- License: apache-2.0
- Created: 2022-11-17T07:13:26.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-11-20T08:55:52.000Z (about 3 years ago)
- Last Synced: 2025-02-14T22:32:34.203Z (11 months ago)
- Language: Rust
- Size: 15.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rust-lib-via-cpp
The project is a minimal demo for calling Rust library in C++.
## Build rust lib
```
cargo build
```
## Build c++ demo application:
```
g++ -std=c++17 -o cpp_program src/main.cpp \
-I .. -I target/cxxbridge \
-L target/debug -l arustlib \
-pthread -l dl
```
Reference:
* https://stackoverflow.com/questions/71097948/failing-to-use-cxx-to-link-rust-written-library-in-c-project
* https://cxx.rs/