WebAssembly (WASM) has been available on Cloudflare (CF) since late 2018. How usable this is in practice depends on what you're trying to do. Given th

Actually Running C++ on Cloudflare WebAssembly

submited by
Style Pass
2025-08-03 10:00:04

WebAssembly (WASM) has been available on Cloudflare (CF) since late 2018. How usable this is in practice depends on what you're trying to do.

Given that Saus otherwise runs fully-locally, I wanted to minimize the complexity added by service hosting. This motivated the use of existing C++ code and tooling with as few changes as possible, to not fragment logic across C++ and JS.

My motivation to try and deploy a Cloudflare Worker instead of a container on AWS/GCP/etc comes from a decade of experience doing the latter, and the insane complexity these platforms now normalize.

Cloudflare has some tempting demos of deploying self-contained C/C++ to WASM, but if you want to communicate with the outside world, things quickly get trickier.

Rust enjoys 1st-party support built upon wasm-bindgen - C++ not so much. Thankfully the wonderful/crazy Emscripten plugs that gap - let's get started.

At the outset, a standalone WASM executable seemed the natural, ideal goal. This means compiling against WASI (Web Assembly System Interface) system calls, avoiding the need to manually go through JS to reach the outside world.

Leave a Comment
Related Posts