Stream: wasmtime

Topic: ✔ exported globals vs WASI


view this post on Zulip Stephan Renatus (Aug 11 2022 at 18:20):

Trying to retrofit an existing wasm module with a wasi interface, I've stumbled upon this:

1: command export 'opa_wasm_abi_version' is not a function

and indeed, that's a global _variable_ -- I was wondering why that must raise an error? I'd have thought they could just be ignored.

view this post on Zulip Peter Huene (Aug 11 2022 at 18:28):

The general idea is that command modules should only be exporting functions (and a few other "well-known" items); if you pass --allow-unknown-exports it'll bypass that check

view this post on Zulip Peter Huene (Aug 11 2022 at 18:29):

Or Linker::allow_unknown_exports if you're writing a host

view this post on Zulip Stephan Renatus (Aug 11 2022 at 18:40):

I see, thanks! Is that part of the wasi spec, or something that's wasmtime-specific?

view this post on Zulip Dan Gohman (Aug 11 2022 at 18:41):

It had started to be part of the WASI spec, but that part of WASI is being moved into the component-model spec.

view this post on Zulip Dan Gohman (Aug 11 2022 at 18:42):

The underlying reason is that in a command-style program, you call the program once, it does its thing, and then exits, so there shouldn't be any other function exports.

view this post on Zulip Stephan Renatus (Aug 11 2022 at 18:53):

@Dan Gohman @Peter Huene thanks (again)

view this post on Zulip Notification Bot (Aug 11 2022 at 18:53):

Stephan Renatus has marked this topic as resolved.


Last updated: Dec 23 2024 at 13:07 UTC