WASM-to-WASM FFI within the browser

⚓ rust    📅 2025-06-09    👤 surdeus    👁️ 2      

surdeus

I'm writing a fairly lightweight Rust application to be compiled to WebAssembly and run in the browser. This application also includes some much heavier functionality which isn't always needed which I would like, if possible, to load on demand so as not to bog down the browser unneccessarily. This extra functionality is currently written in C++, although porting it to Rust wouldn't be too hard. My current plan is to build the light functionality and heavy functionality as two separate WASM files.

Is there a good way to call from WASM to WASM within the browser without JS as an intermediary (it's okay if both have to be Rust and same compiler version -- my Nix-based build script is more than capable of guaranteeing that), or is marshalling through JS my best bet?

2 posts - 2 participants

Read full topic

🏷️ rust_feed