| Crates.io | nym-cpp-ffi |
| lib.rs | nym-cpp-ffi |
| version | 1.20.4 |
| created_at | 2026-01-22 02:36:57.488992+00 |
| updated_at | 2026-01-22 02:36:57.488992+00 |
| description | C++ FFI bindings for Nym Rust SDK |
| homepage | https://nymtech.net |
| repository | https://github.com/nymtech/nym |
| max_upload_size | |
| id | 2060592 |
| size | 203,154 |
⚠️ This is an initial version of this library in order to give developers something to experiment with. If you use this code to begin testing out Mixnet integration and run into issues, errors, or have feedback, please feel free to open an issue; feedback from developers trying to use it will help us improve it. If you have questions feel free to reach out via our Matrix channel.
This repo contains:
lib.rs: an initial version of bindings for interacting with the Mixnet via the Rust SDK from C++. These are essentially match statements wrapping imported functions from the nym-ffi-shared lib allowing for nicer error handling.main.cpp: an example of using this library, relying on Boost for threads.The example .cpp file is a simple example flow of:
sender_tag used for anonymous replies with SURBsUnlike the Go FFI code, this code does not yet have bindings for the TcpProxyClient/Server. This will happen in the future.
Prerequisites:
# Arch / Manjaro
yay -S boost boost-libs
# Debian / Ubuntu
sudo apt install libboost-all-dev
The build.sh script in the root of the repository speeds up the task of building and linking the Rust and C++ code.
./build.shclean argument: ./build.sh clean.Make sure to run the script from the root of the project directory.
This script will:
clean argument) remove existing Rust and C++ artifactslib.rs with the --release flagmain.cpp, linking lib.rsLD_LIBRARY_PATH to the Rust code in target/release/mainWhen calling a function across the FFI boundary (e.g.) reply, the Rust code is matching the output of an _internal function - Res or Err - to a member of the StatusCode enum. This allows for both Rust-style error handling and the ease of returning a c_int across the FFI boundary, which can be used by C++ for its own error handling / conditional logic.