MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime-go / ModuleValidate

Function ModuleValidate

module_feat_cranelift.go:37–50  ·  view source on GitHub ↗

ModuleValidate validates whether `wasm` would be a valid wasm module according to the configuration in `store`

(engine *Engine, wasm []byte)

Source from the content-addressed store, hash-verified

35// ModuleValidate validates whether `wasm` would be a valid wasm module according to the
36// configuration in `store`
37func ModuleValidate(engine *Engine, wasm []byte) error {
38 var wasmPtr *C.uint8_t
39 if len(wasm) > 0 {
40 wasmPtr = (*C.uint8_t)(unsafe.Pointer(&wasm[0]))
41 }
42 err := C.wasmtime_module_validate(engine.ptr(), wasmPtr, C.size_t(len(wasm)))
43 runtime.KeepAlive(engine)
44 runtime.KeepAlive(wasm)
45 if err == nil {
46 return nil
47 }
48
49 return mkError(err)
50}
51
52// Serialize will convert this in-memory compiled module into a list of bytes.
53//

Callers 1

TestModuleValidateFunction · 0.85

Calls 2

mkErrorFunction · 0.85
ptrMethod · 0.45

Tested by 1

TestModuleValidateFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…