Stream: general

Topic: ✔ custom WIT component, must implement wasi:cli/imports ?


view this post on Zulip Joel (Sep 21 2025 at 07:54):

Cool, I answered my own question. So, if I include stuff like wasi:cli into my custom world, I need to copy this line so that my host implementation bindgen looks like this:

        with: {
            // All interfaces in the wasi:io package should be aliased to
            // the wasmtime-wasi-io generated code. Note that this will also
            // map the resource types to those defined in that crate as well.
            "wasi:io/poll": wasmtime_wasi_io::bindings::wasi::io::poll,
            "wasi:io/streams": wasmtime_wasi_io::bindings::wasi::io::streams,
            "wasi:io/error": wasmtime_wasi_io::bindings::wasi::io::error,

            // Configure all other resources to be concrete types defined in
            // this crate
            "wasi:sockets/network/network": crate::p2::network::Network,
            "wasi:sockets/tcp/tcp-socket": crate::sockets::TcpSocket,
            "wasi:sockets/udp/udp-socket": crate::sockets::UdpSocket,
            "wasi:sockets/udp/incoming-datagram-stream": crate::p2::udp::IncomingDatagramStream,
            "wasi:sockets/udp/outgoing-datagram-stream": crate::p2::udp::OutgoingDatagramStream,
            "wasi:sockets/ip-name-lookup/resolve-address-stream": crate::p2::ip_name_lookup::ResolveAddressStream,
            "wasi:filesystem/types/directory-entry-stream": crate::p2::filesystem::ReaddirIterator,
            "wasi:filesystem/types/descriptor": crate::filesystem::Descriptor,
            "wasi:cli/terminal-input/terminal-input": crate::p2::stdio::TerminalInput,
            "wasi:cli/terminal-output/terminal-output": crate::p2::stdio::TerminalOutput,
        },
    });

Then, I link with:

myplugin::add_to_linker(&mut linker,&linkeropts,|f|f);

view this post on Zulip Notification Bot (Sep 21 2025 at 07:54):

Joel has marked this topic as resolved.


Last updated: Dec 06 2025 at 05:03 UTC