Skip to content
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

Adding versioning macros to the C API? #5635

Closed
thibaultcha opened this issue Jan 25, 2023 · 1 comment · Fixed by #5651
Closed

Adding versioning macros to the C API? #5635

thibaultcha opened this issue Jan 25, 2023 · 1 comment · Fixed by #5651
Labels
wasmtime:c-api Issues pertaining to the C API.

Comments

@thibaultcha
Copy link
Contributor

Feature

Could we add versioning macros to the C API in wasmtime.h?

Benefit

As our embedder program can be linked against several Wasm runtimes, we wish to add compilation guards ensuring the version of these runtimes is either tested or compatible with the targets chosen by our users; without them having to face numerous compilation errors or more obscure behavior when it is not the case.

E.g.

#if WASMTIME_VERSION_MAJOR != 5
#error Unsupported Wasmtime version detected, please use Wasmtime 5.x.y
#endif

Implementation

E.g.

// wasmtime.h
#define WASMTIME_VERSION "5.0.0"
#define WASMTIME_VERSION_MAJOR 5
#define WASMTIME_VERSION_MINOR 0
#define WASMTIME_VERSION_PATCH 0

Alternatives

N/A

@thibaultcha thibaultcha changed the title Adding versionning macros to the C API? Adding versioning macros to the C API? Jan 25, 2023
@alexcrichton alexcrichton added the wasmtime:c-api Issues pertaining to the C API. label Jan 25, 2023
@alexcrichton
Copy link
Member

Seems reasonable to me to add!

One thing to watch out for though is that we'll want support in https://github.com/bytecodealliance/wasmtime/blob/main/scripts/publish.rs to have that script update these version numbers along with other version numbers.

thibaultcha added a commit to thibaultcha/wasmtime that referenced this issue Jan 29, 2023
* Add several `WASMTIME_VERSION_*` macros to `wasmtime.h`.
* Update `scripts/publish.rs`
  * To set these macros as per the new version in `./Cargo.toml` during
    `./publish bump`.
  * To verify the macros match the version in `./Cargo.toml` during
    `./publish verify`.

Fix bytecodealliance#5635
thibaultcha added a commit to thibaultcha/wasmtime that referenced this issue Jan 29, 2023
* Add several `WASMTIME_VERSION_*` macros to `wasmtime.h`.
* Update `scripts/publish.rs`
  * To set these macros as per the new version in `./Cargo.toml` during
    `./publish bump`.
  * To verify the macros match the version in `./Cargo.toml` during
    `./publish verify`.

Fix bytecodealliance#5635
alexcrichton pushed a commit that referenced this issue Jan 30, 2023
* Add several `WASMTIME_VERSION_*` macros to `wasmtime.h`.
* Update `scripts/publish.rs`
  * To set these macros as per the new version in `./Cargo.toml` during
    `./publish bump`.
  * To verify the macros match the version in `./Cargo.toml` during
    `./publish verify`.

Fix #5635
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasmtime:c-api Issues pertaining to the C API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants