beetlebug▾
/

ztcl::wasm::host delete

Frees what each family made for the instances, and deletes them.

ztcl::wasm::host delete ?INSTANCE ...?

Description

For each instance, deletes each guest that the module made with the family vm, then deletes the instance with ztcl::wasm delete. An instance of ztcl::wasm instantiate has no families, and the command only deletes it.

Returns

An empty string.

Examples

Each example of this page runs after package require ztcl::wasm::host # (import "vm" "last_error" (func (param i32 i32) (result i32))), (import "vm" "start" (func (param i32) (result i32))), (memory (export "memory") 1), and an export of each import set m [ztcl::wasm new [binary decode hex 0061736d01000000010c0260027f7f017f60017f017f021c0202766d0a6c6173745f6572726f72000002766d05737461727400010503010001071f03066d656d6f727902000a6c6173745f6572726f7200000573746172740001]] .

% set d [ztcl::wasm::host instantiate $m -grant {vm {}}]
> ztcl::wasm::host delete $d

% set d [ztcl::wasm::host instantiate $m -grant {vm {}}]
> ztcl::wasm::host delete $d
> catch {ztcl::wasm call $d start 1} msg opts
> list [string match {can not find wasm instance*} $msg] [dict get $opts -errorcode]
1 {ZTCL WASM HANDLE}

Errors

% ztcl::wasm::host delete bogus
can not find wasm instance "bogus"
-errorcode ZTCL WASM HANDLE

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztcl 1.0.0-beta.4

See also