Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion component_linker_feat_component_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,18 @@ func (l *ComponentLinker) DefineUnknownImportsAsTraps(component *Component) erro
// wasmtime-py's `Linker.locked` for the reference pattern). The
// `wasmtime_component_linker_allow_shadowing` knob is meaningful only once
// definitions exist, so it will be wired up alongside the host-side API.
// TODO: WASIp2 / wasi:http integration via `wasmtime_component_linker_add_*`.

// AddWASIP2 defines Wasmtime's synchronous WASIp2 interfaces in this linker.
func (l *ComponentLinker) AddWASIP2() error {
err := C.wasmtime_component_linker_add_wasip2(l.ptr())
runtime.KeepAlive(l)
if err != nil {
return mkError(err)
}
return nil
}

// TODO: wasi:http integration via `wasmtime_component_linker_add_wasi_http`.

// Close deallocates this linker's state explicitly.
//
Expand Down
8 changes: 8 additions & 0 deletions component_linker_feat_component_model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,11 @@ func TestComponentDefineUnknownImportsAsTraps(t *testing.T) {
})
}
}

func TestComponentLinkerAddWASIP2(t *testing.T) {
engine := newComponentEngine()
defer engine.Close()
linker := NewComponentLinker(engine)
defer linker.Close()
require.NoError(t, linker.AddWASIP2())
}
Loading