poconnor-pilz opened issue #11580:
Hi,
Is there any way to enable exception handling in the C-API build for windows or do I need to wait for full support? I tried modifying the CMakeLists.txt with:
set(WASMTIME_USER_CARGO_BUILD_OPTIONS "--features=cranelift,gc" CACHE STRING "Additional cargo flags (such as --features) to apply to the build command")
But it doesn't seem to work. I want to build wasmtime.dll for windows with exception handling so that I can run Lua in wasmtime-dotnet. (I'm doing work for the OPC Foundation to enable constraint handling)
Thanks,
Peter.
alexcrichton commented on issue #11580:
From our support table the C API doesn't have support for the exceptions proposal yet. Adding it in theory wouldn't be too hard though, especially if all you're interested in is the config knob (which'd just be copy/pasting what's done for other config knobs). Would you be interested in sending a PR?
alexcrichton added the wasmtime:c-api label to Issue #11580.
alexcrichton added the wasm-proposal:exceptions label to Issue #11580.
poconnor-pilz commented on issue #11580:
Thanks, I thought that it wouldn't be something that you configure. It should be just built in. I can't think of anything that would not want exception handling. For example in emscripten exception handing is not something that you turn on or off. You just build your Wasm module and if it happens to call setjmp then it just gets handled. I thought that the config knob I need to set is a build switch like set(WASMTIME_USER_CARGO_BUILD_OPTIONS "--features=cranelift,gc" ) but that does not seem to work.
poconnor-pilz edited a comment on issue #11580:
Thanks, I thought that it wouldn't be something that you configure at run time. It should be just built in. I can't think of anything that would not want exception handling. For example in emscripten exception handing is not something that you turn on or off. You just build your Wasm module and if it happens to call setjmp then it just gets handled. I thought that the config knob I need to set is a build switch like set(WASMTIME_USER_CARGO_BUILD_OPTIONS "--features=cranelift,gc" ) but that does not seem to work.
alexcrichton commented on issue #11580:
That's understandable, but that's not how it works in Wasmtime. From our support table the C API doesn't support exceptions currently, so that's our current baseline. Wasm proposals have a process of being implemented and stabilized in Wasmtime, also linked from that documentation. Exception support is not "done" to be on-by-default currently, as the linked documentation indicates.
Building in support for exceptions will require the "gc" feature in the long term, and in the near term it requires explicit opt-in as it's not a stable proposal in Wasmtime.
poconnor-pilz commented on issue #11580:
Thanks for the explanation. I'll look into how to configure it. If I can make a PR, I will, but I don't know Rust at all (used to do a lot of C++ a long time ago) so I'm not sure how much progress I will make in the time that I will get.
Last updated: Dec 06 2025 at 07:03 UTC