Skip to content

Fix Windows interop and toggle dev ABI with DevBuild#355

Open
tomohisa wants to merge 3 commits intobytecodealliance:mainfrom
J-Tech-Japan:pr/interop-devbuild
Open

Fix Windows interop and toggle dev ABI with DevBuild#355
tomohisa wants to merge 3 commits intobytecodealliance:mainfrom
J-Tech-Japan:pr/interop-devbuild

Conversation

@tomohisa
Copy link

@tomohisa tomohisa commented Feb 1, 2026

Summary

  • Use cdecl for wasmtime P/Invoke and native callbacks.
  • Toggle dev/stable ABI layouts and TrapCode by DevBuild.
  • Document DevBuild switch in README.

Why

CI runs with DevBuild=true (wasmtime-dev), which requires dev ABI layouts.
This fixes test-host crashes such as unknown wasmtime_valkind_t.

Tests

  • (CI) dotnet test Wasmtime.sln

Unreachable = 9,
/// <summary>The trap was the result of interrupting execution.</summary>
Interrupt = 10,
#if WASMTIME_DEV
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see any mention in the wasmtime docs that these traps only exist in dev builds. Are you certain this is correct?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for checking. I agree this isn’t about ‘dev‑only’ traps. The issue is ABI layout: the C API enum in trap.h lists entries without explicit numeric assignments, so the ordinal values are defined by order and can shift when new variants are inserted. docs.wasmtime.dev

The Rust docs also note that C‑API values and Rust trap codes must be kept in sync and that the enum is non‑exhaustive. rustdocs.bsx.fi That’s why #if WASMTIME_DEV currently selects the ABI layout that matches the Wasmtime build being linked. I’m open to making this more explicit (e.g., WASMTIME_TARGET_VERSION=35 vs =dev), but the immediate goal is to avoid ABI mismatches so latest builds don’t fail by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants