Write C++ once, bind everywhere — automatically.
Generate Python, Lua, and JavaScript bindings from C++ using C++26 reflection. Zero boilerplate, zero runtime overhead, zero binding code.
Experimental: Requires C++26 reflection (P2996) via Bloomberg's clang-p2996.
struct Calculator {
double value = 0.0;
double add(double x) { return value += x; }
double subtract(double x) { return value -= x; }
};mirror_bridge generate src/ --module calc --lang allPython | Lua | JavaScript
import calc
c = calc.Calculator()
c.add(10)
print(c.value) # 10.0No installation required — run in your browser or with Docker:
Interactive Playground - Godbolt examples showing C++26 reflection in action
GitHub Codespaces (browser-based, ~2 min):
Docker (local, one command):
docker run -it --rm -v $(pwd):/workspace ghcr.io/franciscothiesen/mirror_bridge:latestThen inside the container:
cd examples/01-hello-world
../../tools/mirror_bridge generate src/ --module greeter --lang python
python3 test_greeter.py# 1. Get the environment
./start_dev_container.sh # Choose option 1 for pre-built image
# 2. Verify
./tests/run_all_tests.sh
# 3. Try an example
cd examples/01-hello-world
../../tools/mirror_bridge generate src/ --module greeter --lang python
python3 test_greeter.py| Language | Status | Auto-Discovery |
|---|---|---|
| Python | Stable | --lang python |
| Lua | Stable | --lang lua |
| JavaScript (Node.js) | Stable | --lang js |
| Feature | Python | Lua | JavaScript |
|---|---|---|---|
| Data Members | ✅ | ✅ | ✅ |
| Methods (any arity) | ✅ | ✅ | ✅ |
| Constructors | ✅ | ✅ | ✅ |
| Containers (vector/array) | ✅ | ✅ | ✅ |
| Maps (map/unordered_map) | ✅ | ✅ | ✅ |
| Sets (set/unordered_set) | ✅ | ✅ | ✅ |
| Tuples (tuple/pair) | ✅ | ✅ | ✅ |
| Variants (std::variant) | ✅ | ✅ | ✅ |
| Nested Objects | ✅ | ✅ | ✅ |
| Enums | ✅ | ✅ | ✅ |
| Inheritance | ✅ | ✅ | ✅ |
| Method Overloading | ✅ | ||
| Smart Pointers | ✅ | ||
| Exception Handling | ✅ | ❌ | ❌ |
| Cross-Module Types | ✅ | ❌ | ❌ |
| Zero-Copy Buffers | ✅ | ❌ | ❌ |
| Async/Await | ✅ | ❌ | ✅ |
| std::optional | ✅ | ✅ | ✅ |
✅ Full support
- Precompiled headers: 3-6x faster builds
- Auto-discovery: Zero binding code required
- Type stubs:
.pyigeneration for Python IDE support
| Topic | Description |
|---|---|
| Getting Started | Quick start, installation, first binding |
| Guides | Workflow, PCH, multi-language, contributing |
| Reference | CLI, API, configuration, type conversion |
| Architecture | System design and internals |
| Examples | Progressive examples from hello-world to production |
# Auto-discover and compile
mirror_bridge generate src/ --module my_mod --lang python
# With precompiled header (faster)
mirror_bridge pch --output build/ --type release
mirror_bridge generate src/ --module my_mod --lang python --pch
# Multiple languages
mirror_bridge generate src/ --module my_mod --lang all| Metric | Mirror Bridge | Traditional |
|---|---|---|
| Binding code | 0 lines | 18+ lines/class |
| Compile time (with PCH) | ~250ms | ~200ms |
| Runtime overhead | Zero | Minimal |
mirror_bridge/
├── core/ # Language-agnostic reflection
├── python/ # Python C API bindings
├── lua/ # Lua C API bindings
├── javascript/ # Node.js N-API bindings
├── tools/mirror_bridge # Unified CLI
├── docs/ # Documentation
├── examples/ # Progressive examples
└── tests/ # Test suite
- Compiler: Bloomberg clang-p2996 (provided via Docker)
- Python: 3.7+ | Lua: 5.4 | Node.js: 14+
See Contributing Guide for development setup and guidelines.
Apache License 2.0 — See LICENSE