Stream: wasi

Topic: ✔ WIT Guest resource as parameter of host function


view this post on Zulip lkjhaisduhjfkxcjvbnis (Aug 09 2024 at 17:07):

Take this as an example:

package test:project;

interface host-interface {
    use guest-interface.{guest-resource};

    host-function: func(arg: guest-resource);
}

interface guest-interface {
    resource guest-resource {
        guest-function: func();
    }
}

world test-world {
    import host-interface;
    export guest-interface;
}

I want my imported host-function to be passed the exported guest-resource.
However when generating host bindings for the spec i am also forced to implement guest-interface on the host side.
I assume that due to the use statement the guest-resource is seen as part of the host-interface, forcing me to implement the guest-interface.
I dont want to do that though.
Is there a way to achieve this?

view this post on Zulip Pat Hickey (Aug 09 2024 at 17:09):

this is another instance of the "cant use an exported resource in imports" problem, let me see if I can find a previous discussion to refer you to

view this post on Zulip lkjhaisduhjfkxcjvbnis (Aug 09 2024 at 17:09):

Sounds about right please do

view this post on Zulip Pat Hickey (Aug 09 2024 at 17:14):

https://bytecodealliance.zulipchat.com/#narrow/stream/206238-general/topic/Passing.20an.20exported.20resource.20into.20an.20imported.20function.20-.20wit/near/455167992

view this post on Zulip lkjhaisduhjfkxcjvbnis (Aug 09 2024 at 17:15):

thank you

view this post on Zulip Notification Bot (Aug 09 2024 at 17:16):

lkjhaisduhjfkxcjvbnis has marked this topic as resolved.


Last updated: Nov 22 2024 at 16:03 UTC