Skip to content

Fix wasmtime P/Invoke calling convention on Windows#351

Closed
tomohisa wants to merge 2 commits intobytecodealliance:mainfrom
J-Tech-Japan:pr/interop-cdecl
Closed

Fix wasmtime P/Invoke calling convention on Windows#351
tomohisa wants to merge 2 commits intobytecodealliance:mainfrom
J-Tech-Japan:pr/interop-cdecl

Conversation

@tomohisa
Copy link

@tomohisa tomohisa commented Feb 1, 2026

Summary

  • Explicitly set CallingConvention.Cdecl for wasmtime native imports.
  • Mark native callback delegates as cdecl to avoid ABI mismatch.

Why

Windows/x86 defaults to stdcall; Wasmtime C API is cdecl. This avoids stack corruption.

Tests

  • (macOS) dotnet test tests/Wasmtime.Tests.csproj -c Release

Risk

Low. This is ABI correctness; no behavior change on platforms already using cdecl.

@tomohisa tomohisa marked this pull request as draft February 1, 2026 06:42
@tomohisa
Copy link
Author

tomohisa commented Feb 1, 2026

Superseded by #355, which combines the cdecl fix + DevBuild
ABI toggle to make CI green. Please review #355 instead.

@tomohisa tomohisa closed this Feb 1, 2026
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.

1 participant