component-model
component-model copied to clipboard
How instantiate, argument and namespace interactive?
Below text is the binary built from https://github.com/sunfishcode/hello-wasi-http/tree/29205a0749835bd65be65841640af913be9be794 and use wasm-tools dump *.wasm to get.
[instance 6] Instantiate { component_index: 0, args: [ComponentInstantiationArg { name: "import-func-handle", kind: Func, index: 11 }, Compon
entInstantiationArg { name: "import-type-incoming-request", kind: Type, index: 25 }, ComponentInstantiationArg { name: "import-type-response-outparam", kind: Type, ind
ex: 26 }, ComponentInstantiationArg { name: "import-type-incoming-request0", kind: Type, index: 20 }, ComponentInstantiationArg { name: "import-type-response-outparam0
", kind: Type, index: 22 }] }
I stuck in this case, this part is trying to instantiate the component 0 with some arguments. The particular argument import-type-incoming-request has index 25, I thought that is the index of a component instance, and found that's wrong guess.
Indeed, there is a type 25:
alias [type 25] InstanceExport { kind: Type, instance_index: 5, name: "incoming-request" }
This confuse me because I think
- instantiation argument's name is given to correspond to imports in the component
0 - the kind is
Typemeans instantiate the component0with a type (in the component should have a type import) - index 25 is the index of type
Since they seems all wrong, I'm not sure how these interactive now.