Wasmtime
wat.h File Reference
#include <wasmtime/conf.h>
#include <wasmtime/error.h>

Go to the source code of this file.

Functions

wasmtime_error_twasmtime_wat2wasm (const char *wat, size_t wat_len, wasm_byte_vec_t *ret)
 Converts from the text format of WebAssembly to the binary format. More...
 

Detailed Description

APIs for converting the text format to binary

Function Documentation

◆ wasmtime_wat2wasm()

wasmtime_error_t * wasmtime_wat2wasm ( const char *  wat,
size_t  wat_len,
wasm_byte_vec_t ret 
)

Converts from the text format of WebAssembly to the binary format.

Parameters
watthis it the input pointer with the WebAssembly Text Format inside of it. This will be parsed and converted to the binary format.
wat_lenthis it the length of wat, in bytes.
retif the conversion is successful, this byte vector is filled in with the WebAssembly binary format.
Returns
a non-null error if parsing fails, or returns NULL. If parsing fails then ret isn't touched.

This function does not take ownership of wat, and the caller is expected to deallocate the returned wasmtime_error_t and wasm_byte_vec_t.