DefineModule defines automatic instantiations of the module in this linker. The `name` of the module is the name within the linker, and the `module` is the one that's being instantiated. This function automatically handles WASI Commands and Reactors for instantiation and initialization. For more in
(store Storelike, name string, module *Module)
| 179 | // information see the Rust documentation -- |
| 180 | // https://docs.wasmtime.dev/api/wasmtime/struct.Linker.html#method.module. |
| 181 | func (l *Linker) DefineModule(store Storelike, name string, module *Module) error { |
| 182 | err := C.wasmtime_linker_module( |
| 183 | l.ptr(), |
| 184 | store.Context(), |
| 185 | C._GoStringPtr(name), |
| 186 | C._GoStringLen(name), |
| 187 | module.ptr(), |
| 188 | ) |
| 189 | runtime.KeepAlive(l) |
| 190 | runtime.KeepAlive(name) |
| 191 | runtime.KeepAlive(module) |
| 192 | runtime.KeepAlive(store) |
| 193 | if err == nil { |
| 194 | return nil |
| 195 | } |
| 196 | |
| 197 | return mkError(err) |
| 198 | } |
| 199 | |
| 200 | // DefineUnknownImportsAsTraps defines all otherwise-missing imports of the |
| 201 | // module as functions that immediately trap. |