-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(c-api) wasi_version_t
wasn't bound correctly to C
#2058
Conversation
55ff142
to
434285c
Compare
wasm_version_t
wasn't bound correctly to Cwasi_version_t
wasn't bound correctly to C
bors r+ |
2058: fix(c-api) `wasi_version_t` wasn't bound correctly to C r=Hywan a=Hywan # Description Because the enum variants weren't in uppercase _and_ because one variant (`InvalidVersion`) has a non-literal value, `cbindgen` was ignoring the variants. This patch fixes that. It's not a breaking changes since the WASI version constants weren't present in the `wasmer_wasm.h` file before. Note: `u32::max_value()` is soft-deprecated, we should use `u32::MAX` instead. Notice that none of them works with `cbindgen`, so I've hardcoded the value of `u32::MAX` here. # Review - [x] Add a short description of the the change to the CHANGELOG.md file Co-authored-by: Ivan Enderlin <[email protected]>
Build failed: |
Error on Windows (for the record):
|
On Windows, using a `u32` representation for `wasi_version_t` fails if a C++ compiler is used to treat a C program. So we change our strategy here. We use a C representation to be FFI-safe, and the `INVALID_VERSION` variant is now set to -1 instead of `u32::MAX`. This patch also adds unit tests for `wasi_get_wasi_version` so that we are sure of the behavior of this `type` on all platforms.
|
bors r+ |
Description
Because the enum variants weren't in uppercase and because one variant (
InvalidVersion
) has a non-literal value,cbindgen
was ignoring the variants. This patch fixes that. It's not a breaking changes since the WASI version constants weren't present in thewasmer_wasm.h
file before.Note:
u32::max_value()
is soft-deprecated, we should useu32::MAX
instead. Notice that none of them works withcbindgen
, so I've hardcoded the valueof-1 (now) here.u32::MAX
Review