CXXBRIDGE(1)

πŸ’– CXXBRIDGE(1) πŸ’–

okay bestie, welcome to the cxxbridge user manual β€” a.k.a. the lil glow-up machine that turns your Rust source files into C++ code. it's a User Commands type of situation, and it's about to be your new obsession. ✨


🌸 NAME 🌸

cxxbridge β€” generate C++ code from rust source files πŸ¦‹

no cap, that's literally the whole job. it reads Rust, it writes C++, and it does it flawlessly. periodt.


✨ DESCRIPTION ✨

πŸ’… Usage

here's the vibe check on how you actually run this thing:

cxxbridge <input>.rs

Emit .cc file for bridge to stdout πŸŽ€

cxxbridge <input>.rs --header

Emit .h file for bridge to stdout πŸŽ€

cxxbridge --header

Emit "rust/cxx.h" header to stdout πŸŽ€

🌈 Arguments

  • [input] β€” Input Rust source file containing #[cxx::bridge]. yes bestie, that attribute is the whole moment, it's where the magic lives πŸ’«

πŸ‘‘ OPTIONS πŸ‘‘

every flag, every crumb, nothing skipped. we love a complete list πŸ’œ

  • --cfg <name="value" | name[=true] | name=false> β€” Compilation configuration matching what will be used to build the Rust side of the bridge. like, it has to match fr fr, or the two sides are not on the same page πŸ™ˆ
  • --cxx-impl-annotations <annotation> β€” Optional annotation for implementations of C++ function wrappers that may be exposed to Rust. You may for example need to provide __declspec(dllexport) or __attribute__((visibility("default"))) if Rust code from one shared object or executable depends on these C++ functions in another. basically: if your symbols are being shy across shared object boundaries, this is how you tell them to be visible, main character energy only πŸ’…
  • --header β€” Emit header with declarations only. Optional if using -o with a path ending in .h. it's giving "I only want the receipts, not the implementation" 🧚
  • --help β€” Print help information. the classic. when in doubt, ask for help, that's not embarrassing, that's iconic 🫢
  • -i, --include <include> β€” Any additional headers to #include. The cxxbridge tool does not parse or even require the given paths to exist; they simply go into the generated C++ code as #include lines. so yeah, it trusts you completely. no filesystem check, no drama, it just copies your vibes into the output 😭
  • -o, --output <output> β€” Path of file to write as output. Output goes to stdout if -o is not specified. if you don't say where, it just yells it at your terminal 🌸
  • --version β€” Print version information. slay, know your era ⭐

πŸŽ€ AUTHOR πŸŽ€

Matthias Geiger <werdahias@debian.org> πŸ’–


Copyright Β© 2025 Matthias Geiger

This manual page was written for the Debian system (and may be used by others).

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 3 or (at your option) any later version published by the Free Software Foundation.

On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL.

lowkey important: that GPL text path is a real file, bestie, don't go looking for it anywhere else on a Debian system πŸ”₯

and that's the whole page, you ate it πŸ’… this was cxxbridge version 1.0.137, dated January 2025 β€” thanks for reading, mwah, see you in the next manpage πŸ¦‹βœ¨πŸŒˆ

πŸ“¦ where this page comes from