pi_solver/ ← Rust project (EXE)
src/main.rs
Cargo.toml
vba/
pi_solver.bas ← VBA module for Excel
# Requires Rust (rustup.rs) and MSVC toolchain
cd pi_solver
cargo build --release
# EXE will be at:
# pi_solver\target\release\pi_solver.exe- Create a new workbook and save as
.xlsm(macro-enabled) Alt+F11→Insert→Module- Paste the contents of
vba/pi_solver.bas - Copy
pi_solver.exeto the same folder as the.xlsmfile - Run macro
RunSolver(Alt+F8→RunSolver→Run)
Pipe: \\.\pipe\pi_solver_progress
All messages are UTF-8 strings terminated with \n:
| Message | Format |
|---|---|
| Progress | PROGRESS|<sec>|<iterations>|<pi_estimate>|<error> |
| Done | DONE|<iterations>|<final_estimate> |
| Error | ERROR|<text> |
pi_solver.exe [seconds]
- no arguments — runs for 60 seconds
pi_solver.exe 30— runs for 30 seconds
Excel (VBA) pi_solver.exe
│ │
│── Shell "pi_solver.exe" ─────►│ CreateNamedPipe
│ │ ConnectNamedPipe (waits)
│── CreateFile (open pipe) ────►│ (client connected)
│ │
│◄── PROGRESS|1|500000|3.14... │ every second
│◄── PROGRESS|2|1000000|3.141.. │
│ ... │
│◄── DONE|30000000|3.1415926.. │
│ │
│ CloseHandle │ CloseHandle
| Cell | Content |
|---|---|
| A1/B1 | Status |
| A2/B2 | Time (seconds) |
| A3/B3 | Iteration count |
| A4/B4 | Current PI estimate (10 decimal places) |
| A5/B5 | Error |
| A6/B6 | Path to pi_solver.exe |