alexcrichton opened PR #5215 from update-c-api-traps to main:
Previously extracting an exit code was only possibly on a
wasm_trap_twhich will never successfully have an exit code on it, so the exit code extractor is moved over towasmtime_error_t. Additionally extracting a wasm trace from awasmtime_error_tis added since traces happen on both traps and errors now.<!--
Please ensure that the following steps are all taken care of before submitting
the PR.
[ ] This has been discussed in issue #..., or if not, please tell us why
here.[ ] A short description of what this does, why it is needed; if the
description becomes long, the matter should probably be discussed in an issue
first.[ ] This PR contains test cases, if meaningful.
- [ ] A reviewer from the core maintainer team has been assigned for this PR.
If you don't know who could review this, please indicate so. The list of
suggested reviewers on the right can help you.Please ensure all communication adheres to the code of conduct.
-->
pchickey submitted PR review.
alexcrichton merged PR #5215.
Hi @alexcrichton thanks for all your good work. I'm trying to understand how to implement
proc_exitin a custom C++ wasm host that uses the wasmtime C API. It seems there is no way to return a trap with an exit code from a host function. What am I missing? Thanks.
alexcrichton commented on PR #5215:
That's a good point, mind filing a dedicated issue about that? (or a PR, should be a small addition)
Done, please see https://github.com/bytecodealliance/wasmtime/issues/11061.
Last updated: Dec 13 2025 at 19:03 UTC