I am working on a small hobby project which intends to run WAMR on an ESP32 exposing a small set of custom native functions for applications to work with on the ESP32. I would also like to build a small web front-end to demo applications and test... to that end I was hoping to build the exact same runtime (WAMR) on both the ESP32 and for the Web (using Emscripten) with the same native functions wired up in both environments. Cross-compiling to Emscripten does not work out of the box but #if 0/#endif out the contents of platform_wasi_types.h and selecting WAMR_BUILD_INVOKE_NATIVE_GENERAL in CMake does make everything compile.. unfortunately it does not work when run.
I suspect that the general invokeNative does not work for Emscripten but am at a bit of a loss on how I could make it work with the JS runtime... any advice would be greatly appreciated. I have experience with embedded systems but not much with WASM.
P.S. I am only trying to run in interpreted mode right now.
I'm not entirely clear on the part about "building WAMR for the web with emscripten." Is it suggesting that WAMR is translated into a WebAssembly application using emscripten?
as wasm is strict on function types, i don't think there is a reasonable way to implement invokeNative as of today for wasm.
Sorry! wanted to open a new issue.
Last updated: Dec 06 2025 at 07:03 UTC