A little C/C++
with your Rust
. The "Hello world" to building Rust apps with C/C++ libs.
The easiest way to get started is by using the Visual Studio Code Remote - Containers / Codespaces development container included in this repository. This container comes with Rust, Cargo, and several VSCode extensions pre-installed to help you get started quickly.
- For Remote - Containers, use the Remote-Containers: Open Repository in Container... command which creates a Docker volume for better disk I/O on macOS and Windows.
- For Codespaces, install the GitHub Codespaces extension in VSCode, and use the Codespaces: Create New Codespace command.
Once your workspace is setup, open a terminal to check everything is working:
cargo --version
rustc --version
To build the project, run the following command:
cargo run
This will compile and link the C library using cmake-rs, generate the Rust bindings using bindgen, and run the application.
To pass arguments to the program, use the following command:
cargo run -- <arg>