Stream: wasi

Topic: dlopen and (web)sockets


view this post on Zulip ovf (Jun 29 2023 at 18:03):

i'm working on porting our application to wasi, and i'm interested in what the plans are for two interfaces that would be useful for us:

as discussed earlier in #general, i wouldn't be so dependent on wasi for these if it wasn't for the fact that i can't have a wasi-compatible application with optional non-wasi imports.

view this post on Zulip Lann Martin (Jun 29 2023 at 18:07):

re: dlopen, it isn't at all straightforward to implement, but @Joel Dice is doing it anyway :smile:

view this post on Zulip Robin Brown (Jun 29 2023 at 18:07):

There is a sockets proposal in wasi
https://github.com/WebAssembly/wasi-sockets/

view this post on Zulip ovf (Jun 29 2023 at 18:08):

Lann Martin said:

re: dlopen, it isn't at all straightforward to implement, but Joel Dice is doing it anyway :smile:

thanks! any pointers?

view this post on Zulip Joel Dice (Jun 29 2023 at 18:09):

See https://github.com/dicej/component-linking-demo (when GitHub is back up) for an example of using dlopen with WASI. It currently requires patched versions of wasi_sdk and wasm-tools, which I'm in the process of getting upstreamed.

view this post on Zulip ovf (Jun 29 2023 at 18:12):

Kyle Brown said:

There is a sockets proposal in wasi
https://github.com/WebAssembly/wasi-sockets/

what's the status of that in layman's terms (i.e. it's making its way into preview2, etc.)? sorry to say the wasi spec process appears a little opaque from an outsider's perspective

view this post on Zulip ovf (Jun 29 2023 at 18:22):

Joel Dice said:

See https://github.com/dicej/component-linking-demo (when GitHub is back up) for an example of using dlopen with WASI. It currently requires patched versions of wasi_sdk and wasm-tools, which I'm in the process of getting upstreamed.

that seems to rely on the runtime supplying a static set of libraries/symbols at startup?

view this post on Zulip Robin Brown (Jun 29 2023 at 18:31):

Ya, I like to call it "not-quite-dynamic" linking because it hooks into dynamic linking/loading APIs but does require you to have them all at build time.

view this post on Zulip Robin Brown (Jun 29 2023 at 18:32):

I'm not sure the exact status of the proposal. @Badeend who is its champion may be able to help summarize.

view this post on Zulip Joel Dice (Jun 29 2023 at 18:35):

that seems to rely on the runtime supplying a static set of libraries/symbols at startup?

Yes, that's correct. I've been calling it pseudo-dynamic linking. Truly dynamic linking is out of scope for the time being. You could probably rig something up on your own, e.g. via trampoline functions using Wasmtime's embedding API.

view this post on Zulip Joel Dice (Jun 29 2023 at 18:36):

I'm not sure what a standardized form of true dynamic linking would look like; it's not something I've thought about much, yet.

view this post on Zulip ovf (Jun 29 2023 at 18:42):

i guess if done unix-style, there effectively be all the complexity of a dynamic linker including recursive dependencies


Last updated: Nov 22 2024 at 16:03 UTC