Path: blob/main/crates/c-api/include/doc-wasm.h
1692 views
/* clang-format off */12/**3* \file wasm.h4*5* Upstream Embedding API for WebAssembly.6*7* This API is defined by the upstream wasm-c-api proposal at8* https://github.com/WebAssembly/wasm-c-api. That proposal is in flux but9* Wasmtime intends to be active in its development.10*11* The documentation for this header file is currently defined in the Wasmtime12* project, not in the upstream header file. Some behavior here may be13* Wasmtime-specific and may not be portable to other engines implementing the14* same C API. Also note that not all functionality from the upstream C API is15* implemented in Wasmtime. We strive to provide all symbols as to not generate16* link errors but some functions are unimplemented and will abort the process17* if called.18*19* ### Memory Management20*21* Memory management in the wasm C API is intended to be relatively simple. Each22* individual object is reference counted unless otherwise noted. You can delete23* any object at any time after you no longer need it. Deletion of an object24* does not imply that the memory will be deallocated at that time. If another25* object still internally references the original object then the memory will26* still be alive.27*28* For example you can delete a #wasm_engine_t after you create a #wasm_store_t29* with #wasm_store_new. The engine, however, is still referenced by the30* #wasm_store_t so it will not be deallocated. In essence by calling31* #wasm_engine_delete you're release your own strong reference on the32* #wasm_engine_t, but that's it.33*34* Additionally APIs like #wasm_memory_copy do not actually copy the underlying35* data. Instead they only increment the reference count and return a new36* object. You'll need to still call #wasm_memory_delete (or the corresponding37* `*_delete` function) for each copy of an object you acquire.38*39* ### Vectors40*41* This API provides a number of `wasm_*_vec_t` type definitions and functions42* to work with them. Each vector is defined by a pointer and a length.43* "Ownership" of a vector refers to the data pointer, not the memory holding44* the data pointer and the length. It is safe, for example to create a45* #wasm_name_t on the stack and pass it to #wasm_importtype_new. The memory46* pointed to by #wasm_name_t must be properly initialized, however, and cannot47* reside on the stack.48*/4950/**51* \typedef byte_t52* \brief A type definition for a number that occupies a single byte of data.53*54* \typedef wasm_byte_t55* \brief A type definition for a number that occupies a single byte of data.56*57* \typedef float32_t58* \brief A type definition for a 32-bit float.59*60* \typedef float64_t61* \brief A type definition for a 64-bit float.62*63* \typedef wasm_name_t64* \brief Convenience for hinting that an argument only accepts utf-8 input.65*/6667/**68* \typedef wasm_config_t69* \brief Convenience alias for #wasm_config_t70*71* \struct wasm_config_t72* \brief Global engine configuration73*74* This structure represents global configuration used when constructing a75* #wasm_engine_t. There are now functions to modify this from wasm.h but the76* wasmtime/config.h header provides a number of Wasmtime-specific functions to77* tweak configuration options.78*79* This object is created with #wasm_config_new.80*81* Configuration is safe to share between threads. Typically you'll create a82* config object and immediately pass it into #wasm_engine_new_with_config,83* however.84*85* For more information about configuration see the Rust documentation as well86* at87* https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Config.html.88*89* \fn wasm_config_t *wasm_config_new(void);90* \brief Creates a new empty configuration object.91*92* The object returned is owned by the caller and will need to be deleted with93* #wasm_config_delete. May return `NULL` if a configuration object could not be94* allocated.95*96* \fn void wasm_config_delete(wasm_config_t*);97* \brief Deletes a configuration object.98*/99100/**101* \typedef wasm_engine_t102* \brief Convenience alias for #wasm_engine_t103*104* \struct wasm_engine_t105* \brief Compilation environment and configuration.106*107* An engine is typically global in a program and contains all the configuration108* necessary for compiling wasm code. From an engine you'll typically create a109* #wasmtime_store_t. Engines are created with #wasm_engine_new or110* #wasm_engine_new_with_config.111*112* An engine is safe to share between threads. Multiple stores can be created113* within the same engine with each store living on a separate thread. Typically114* you'll create one #wasm_engine_t for the lifetime of your program.115*116* Engines are reference counted internally so #wasm_engine_delete can be called117* at any time after a #wasmtime_store_t has been created from one.118*119* \fn wasm_engine_t *wasm_engine_new(void);120* \brief Creates a new engine with the default configuration.121*122* The object returned is owned by the caller and will need to be deleted with123* #wasm_engine_delete. This may return `NULL` if the engine could not be124* allocated.125*126* \fn wasm_engine_t *wasm_engine_new_with_config(wasm_config_t *);127* \brief Creates a new engine with the specified configuration.128*129* This function will take ownership of the configuration specified regardless130* of the outcome of this function. You do not need to call #wasm_config_delete131* on the argument. The object returned is owned by the caller and will need to132* be deleted with #wasm_engine_delete. This may return `NULL` if the engine133* could not be allocated.134*135* \fn void wasm_engine_delete(wasm_engine_t*);136* \brief Deletes an engine.137*/138139/**140* \typedef wasm_store_t141* \brief Convenience alias for #wasm_store_t142*143* \struct wasm_store_t144* \brief A collection of instances and wasm global items.145*146* A #wasm_store_t corresponds to the concept of an [embedding147* store](https://webassembly.github.io/spec/core/exec/runtime.html#store)148*149* \fn wasm_store_t *wasm_store_new(wasm_engine_t *);150* \brief Creates a new store within the specified engine.151*152* The object returned is owned by the caller and will need to be deleted with153* #wasm_store_delete. This may return `NULL` if the store could not be154* allocated.155*156* \fn void wasm_store_delete(wasm_store_t *);157* \brief Deletes the specified store.158*/159160/**161* \struct wasm_byte_vec_t162* \brief A list of bytes163*164* Used to pass data in or pass data out of various functions. The meaning and165* ownership of the bytes is defined by each API that operates on this166* datatype.167*168* \var wasm_byte_vec_t::size169* \brief Length of this vector.170*171* \var wasm_byte_vec_t::data172* \brief Pointer to the base of this vector173*174* \typedef wasm_byte_vec_t175* \brief Convenience alias for #wasm_byte_vec_t176*177* \typedef wasm_message_t178* \brief Alias of #wasm_byte_vec_t which always has a trailing 0-byte.179*180* \fn wasm_name181* \brief Unused by Wasmtime182*183* \fn wasm_name_new184* \brief Convenience alias185*186* \fn wasm_name_new_empty187* \brief Convenience alias188*189* \fn wasm_name_new_new_uninitialized190* \brief Convenience alias191*192* \fn wasm_name_new_from_string193* \brief Create a new name from a C string.194*195* \fn wasm_name_new_from_string_nt196* \brief Create a new name from a C string with null terminator.197*198* \fn wasm_name_copy199* \brief Convenience alias200*201* \fn wasm_name_delete202* \brief Convenience alias203*204* \fn void wasm_byte_vec_new_empty(wasm_byte_vec_t *out);205* \brief Initializes an empty byte vector.206*207* \fn void wasm_byte_vec_new_uninitialized(wasm_byte_vec_t *out, size_t);208* \brief Initializes an byte vector with the specified capacity.209*210* This function will initialize the provided vector with capacity to hold the211* specified number of bytes. The `out` parameter must previously not already be212* initialized and after this function is called you are then responsible for213* ensuring #wasm_byte_vec_delete is called.214*215* \fn void wasm_byte_vec_new(wasm_byte_vec_t *out, size_t, wasm_byte_t const[]);216* \brief Copies the specified data into a new byte vector.217*218* This function will copy the provided data into this byte vector. The byte219* vector should not be previously initialized and the caller is responsible for220* calling #wasm_byte_vec_delete after this function returns.221*222* Note that memory of the initialization vector provided to this function223* must be managed externally. This function will copy the contents to the224* output vector, but it's up to the caller to properly deallocate the memory.225*226* \fn void wasm_byte_vec_copy(wasm_byte_vec_t *out, const wasm_byte_vec_t *);227* \brief Copies one vector into a new vector.228*229* Copies the second argument's data into the first argument. The `out` vector230* should not be previously initialized and after this function returns you're231* responsible for calling #wasm_byte_vec_delete.232*233* \fn void wasm_byte_vec_delete(wasm_byte_vec_t *);234* \brief Deletes a byte vector.235*236* This function will deallocate the data referenced by the argument provided.237* This does not deallocate the memory holding the #wasm_byte_vec_t itself, it's238* expected that memory is owned by the caller.239*/240241/**242* \struct wasm_valtype_t243* \brief An object representing the type of a value.244*245* \typedef wasm_valtype_t246* \brief Convenience alias for #wasm_valtype_t247*248* \struct wasm_valtype_vec_t249* \brief A list of #wasm_valtype_t values.250*251* \var wasm_valtype_vec_t::size252* \brief Length of this vector.253*254* \var wasm_valtype_vec_t::data255* \brief Pointer to the base of this vector256*257* \typedef wasm_valtype_vec_t258* \brief Convenience alias for #wasm_valtype_vec_t259*260* \fn void wasm_valtype_delete(wasm_valtype_t *);261* \brief Deletes a type.262*263* \fn void wasm_valtype_vec_new_empty(wasm_valtype_vec_t *out);264* \brief Creates an empty vector.265*266* See #wasm_byte_vec_new_empty for more information.267*268* \fn void wasm_valtype_vec_new_uninitialized(wasm_valtype_vec_t *out, size_t);269* \brief Creates a vector with the given capacity.270*271* See #wasm_byte_vec_new_uninitialized for more information.272*273* \fn void wasm_valtype_vec_new(wasm_valtype_vec_t *out, size_t, wasm_valtype_t *const[]);274* \brief Creates a vector with the provided contents.275*276* See #wasm_byte_vec_new for more information.277*278* \fn void wasm_valtype_vec_copy(wasm_valtype_vec_t *out, const wasm_valtype_vec_t *)279* \brief Copies one vector to another280*281* See #wasm_byte_vec_copy for more information.282*283* \fn void wasm_valtype_vec_delete(wasm_valtype_vec_t *out)284* \brief Deallocates memory for a vector.285*286* See #wasm_byte_vec_delete for more information.287*288* \fn wasm_valtype_t* wasm_valtype_copy(const wasm_valtype_t *)289* \brief Creates a new value which matches the provided one.290*291* The caller is responsible for deleting the returned value.292*293* \fn wasm_valtype_t* wasm_valtype_new(wasm_valkind_t);294* \brief Creates a new value type from the specified kind.295*296* The caller is responsible for deleting the returned value.297*298* \fn wasm_valkind_t wasm_valtype_kind(const wasm_valtype_t *);299* \brief Returns the associated kind for this value type.300*/301302/**303* \typedef wasm_valkind_t304* \brief Different kinds of types supported in wasm.305*/306307/**308* \struct wasm_functype_t309* \brief An opaque object representing the type of a function.310*311* \typedef wasm_functype_t312* \brief Convenience alias for #wasm_functype_t313*314* \struct wasm_functype_vec_t315* \brief A list of #wasm_functype_t values.316*317* \var wasm_functype_vec_t::size318* \brief Length of this vector.319*320* \var wasm_functype_vec_t::data321* \brief Pointer to the base of this vector322*323* \typedef wasm_functype_vec_t324* \brief Convenience alias for #wasm_functype_vec_t325*326* \fn void wasm_functype_delete(wasm_functype_t *);327* \brief Deletes a type.328*329* \fn void wasm_functype_vec_new_empty(wasm_functype_vec_t *out);330* \brief Creates an empty vector.331*332* See #wasm_byte_vec_new_empty for more information.333*334* \fn void wasm_functype_vec_new_uninitialized(wasm_functype_vec_t *out, size_t);335* \brief Creates a vector with the given capacity.336*337* See #wasm_byte_vec_new_uninitialized for more information.338*339* \fn void wasm_functype_vec_new(wasm_functype_vec_t *out, size_t, wasm_functype_t *const[]);340* \brief Creates a vector with the provided contents.341*342* See #wasm_byte_vec_new for more information.343*344* \fn void wasm_functype_vec_copy(wasm_functype_vec_t *out, const wasm_functype_vec_t *)345* \brief Copies one vector to another346*347* See #wasm_byte_vec_copy for more information.348*349* \fn void wasm_functype_vec_delete(wasm_functype_vec_t *out)350* \brief Deallocates memory for a vector.351*352* See #wasm_byte_vec_delete for more information.353*354* \fn wasm_functype_t* wasm_functype_copy(const wasm_functype_t *)355* \brief Creates a new value which matches the provided one.356*357* The caller is responsible for deleting the returned value.358*359* \fn wasm_functype_t* wasm_functype_new(wasm_valtype_vec_t *params, wasm_valtype_vec_t *results);360* \brief Creates a new function type with the provided parameter and result361* types.362*363* This function takes ownership of the `params` and `results` arguments.364*365* The caller is responsible for deleting the returned value.366*367* \fn const wasm_valtype_vec_t* wasm_functype_params(const wasm_functype_t *);368* \brief Returns the list of parameters of this function type.369*370* The returned memory is owned by the #wasm_functype_t argument, the caller371* should not deallocate it.372*373* \fn const wasm_valtype_vec_t* wasm_functype_results(const wasm_functype_t *);374* \brief Returns the list of results of this function type.375*376* The returned memory is owned by the #wasm_functype_t argument, the caller377* should not deallocate it.378*/379380/**381* \struct wasm_globaltype_t382* \brief An opaque object representing the type of a global.383*384* \typedef wasm_globaltype_t385* \brief Convenience alias for #wasm_globaltype_t386*387* \struct wasm_globaltype_vec_t388* \brief A list of #wasm_globaltype_t values.389*390* \var wasm_globaltype_vec_t::size391* \brief Length of this vector.392*393* \var wasm_globaltype_vec_t::data394* \brief Pointer to the base of this vector395*396* \typedef wasm_globaltype_vec_t397* \brief Convenience alias for #wasm_globaltype_vec_t398*399* \fn void wasm_globaltype_delete(wasm_globaltype_t *);400* \brief Deletes a type.401*402* \fn void wasm_globaltype_vec_new_empty(wasm_globaltype_vec_t *out);403* \brief Creates an empty vector.404*405* See #wasm_byte_vec_new_empty for more information.406*407* \fn void wasm_globaltype_vec_new_uninitialized(wasm_globaltype_vec_t *out, size_t);408* \brief Creates a vector with the given capacity.409*410* See #wasm_byte_vec_new_uninitialized for more information.411*412* \fn void wasm_globaltype_vec_new(wasm_globaltype_vec_t *out, size_t, wasm_globaltype_t *const[]);413* \brief Creates a vector with the provided contents.414*415* See #wasm_byte_vec_new for more information.416*417* \fn void wasm_globaltype_vec_copy(wasm_globaltype_vec_t *out, const wasm_globaltype_vec_t *)418* \brief Copies one vector to another419*420* See #wasm_byte_vec_copy for more information.421*422* \fn void wasm_globaltype_vec_delete(wasm_globaltype_vec_t *out)423* \brief Deallocates memory for a vector.424*425* See #wasm_byte_vec_delete for more information.426*427* \fn wasm_globaltype_t* wasm_globaltype_copy(const wasm_globaltype_t *)428* \brief Creates a new value which matches the provided one.429*430* The caller is responsible for deleting the returned value.431*432* \fn wasm_globaltype_t* wasm_globaltype_new(wasm_valtype_t *, wasm_mutability_t)433* \brief Creates a new global type.434*435* This function takes ownership of the #wasm_valtype_t argument.436*437* The caller is responsible for deleting the returned value.438*439* \fn const wasm_valtype_t* wasm_globaltype_content(const wasm_globaltype_t *);440* \brief Returns the type of value contained in a global.441*442* The returned memory is owned by the provided #wasm_globaltype_t, the caller443* should not deallocate it.444*445* \fn wasm_mutability_t wasm_globaltype_mutability(const wasm_globaltype_t *);446* \brief Returns whether or not a global is mutable.447*/448449/**450* \typedef wasm_mutability_t451* \brief Boolean flag for whether a global is mutable or not.452*/453454/**455* \struct wasm_tabletype_t456* \brief An opaque object representing the type of a table.457*458* \typedef wasm_tabletype_t459* \brief Convenience alias for #wasm_tabletype_t460*461* \struct wasm_tabletype_vec_t462* \brief A list of #wasm_tabletype_t values.463*464* \var wasm_tabletype_vec_t::size465* \brief Length of this vector.466*467* \var wasm_tabletype_vec_t::data468* \brief Pointer to the base of this vector469*470* \typedef wasm_tabletype_vec_t471* \brief Convenience alias for #wasm_tabletype_vec_t472*473* \fn void wasm_tabletype_delete(wasm_tabletype_t *);474* \brief Deletes a type.475*476* \fn void wasm_tabletype_vec_new_empty(wasm_tabletype_vec_t *out);477* \brief Creates an empty vector.478*479* See #wasm_byte_vec_new_empty for more information.480*481* \fn void wasm_tabletype_vec_new_uninitialized(wasm_tabletype_vec_t *out, size_t);482* \brief Creates a vector with the given capacity.483*484* See #wasm_byte_vec_new_uninitialized for more information.485*486* \fn void wasm_tabletype_vec_new(wasm_tabletype_vec_t *out, size_t, wasm_tabletype_t *const[]);487* \brief Creates a vector with the provided contents.488*489* See #wasm_byte_vec_new for more information.490*491* \fn void wasm_tabletype_vec_copy(wasm_tabletype_vec_t *out, const wasm_tabletype_vec_t *)492* \brief Copies one vector to another493*494* See #wasm_byte_vec_copy for more information.495*496* \fn void wasm_tabletype_vec_delete(wasm_tabletype_vec_t *out)497* \brief Deallocates memory for a vector.498*499* See #wasm_byte_vec_delete for more information.500*501* \fn wasm_tabletype_t* wasm_tabletype_copy(const wasm_tabletype_t *)502* \brief Creates a new value which matches the provided one.503*504* The caller is responsible for deleting the returned value.505*506* \fn wasm_tabletype_t* wasm_tabletype_new(wasm_valtype_t *, const wasm_limits_t *)h507* \brief Creates a new table type.508*509* This function takes ownership of the #wasm_valtype_t argument, but does not510* take ownership of the #wasm_limits_t.511*512* The caller is responsible for deallocating the returned type.513*514* \fn const wasm_valtype_t* wasm_tabletype_element(const wasm_tabletype_t *);515* \brief Returns the element type of this table.516*517* The returned #wasm_valtype_t is owned by the #wasm_tabletype_t parameter, the518* caller should not deallocate it.519*520* \fn const wasm_limits_t* wasm_tabletype_limits(const wasm_tabletype_t *);521* \brief Returns the limits of this table.522*523* The returned #wasm_limits_t is owned by the #wasm_tabletype_t parameter, the524* caller should not deallocate it.525*/526527/**528* \struct wasm_limits_t529* \brief Limits for tables/memories in wasm modules530* \var wasm_limits_t::min531* The minimum value required.532* \var wasm_limits_t::max533* The maximum value required, or `wasm_limits_max_default` if no maximum is534* specified.535*536* \typedef wasm_limits_t537* \brief A convenience typedef to #wasm_limits_t538*/539540/**541* \struct wasm_memorytype_t542* \brief An opaque object representing the type of a memory.543*544* \typedef wasm_memorytype_t545* \brief Convenience alias for #wasm_memorytype_t546*547* \struct wasm_memorytype_vec_t548* \brief A list of #wasm_memorytype_t values.549*550* \var wasm_memorytype_vec_t::size551* \brief Length of this vector.552*553* \var wasm_memorytype_vec_t::data554* \brief Pointer to the base of this vector555*556* \typedef wasm_memorytype_vec_t557* \brief Convenience alias for #wasm_memorytype_vec_t558*559* \fn void wasm_memorytype_delete(wasm_memorytype_t *);560* \brief Deletes a type.561*562* \fn void wasm_memorytype_vec_new_empty(wasm_memorytype_vec_t *out);563* \brief Creates an empty vector.564*565* See #wasm_byte_vec_new_empty for more information.566*567* \fn void wasm_memorytype_vec_new_uninitialized(wasm_memorytype_vec_t *out, size_t);568* \brief Creates a vector with the given capacity.569*570* See #wasm_byte_vec_new_uninitialized for more information.571*572* \fn void wasm_memorytype_vec_new(wasm_memorytype_vec_t *out, size_t, wasm_memorytype_t *const[]);573* \brief Creates a vector with the provided contents.574*575* See #wasm_byte_vec_new for more information.576*577* \fn void wasm_memorytype_vec_copy(wasm_memorytype_vec_t *out, const wasm_memorytype_vec_t *)578* \brief Copies one vector to another579*580* See #wasm_byte_vec_copy for more information.581*582* \fn void wasm_memorytype_vec_delete(wasm_memorytype_vec_t *out)583* \brief Deallocates memory for a vector.584*585* See #wasm_byte_vec_delete for more information.586*587* \fn wasm_memorytype_t* wasm_memorytype_copy(const wasm_memorytype_t *)588* \brief Creates a new value which matches the provided one.589*590* The caller is responsible for deleting the returned value.591*592* \fn wasm_memorytype_t* wasm_memorytype_new(const wasm_limits_t *)h593* \brief Creates a new memory type.594*595* This function takes ownership of the #wasm_valtype_t argument, but does not596* take ownership of the #wasm_limits_t.597*598* The caller is responsible for deallocating the returned type.599*600* For compatibility with memory64 it's recommended to use601* #wasmtime_memorytype_new instead.602*603* \fn const wasm_limits_t* wasm_memorytype_limits(const wasm_memorytype_t *);604* \brief Returns the limits of this memory.605*606* The returned #wasm_limits_t is owned by the #wasm_memorytype_t parameter, the607* caller should not deallocate it.608*609* For compatibility with memory64 it's recommended to use610* #wasmtime_memorytype_maximum or #wasmtime_memorytype_minimum instead.611*/612613/**614* \struct wasm_externtype_t615* \brief An opaque object representing the type of a external value. Can be616* seen as a superclass of #wasm_functype_t, #wasm_tabletype_t,617* #wasm_globaltype_t, and #wasm_memorytype_t.618*619* \typedef wasm_externtype_t620* \brief Convenience alias for #wasm_externtype_t621*622* \struct wasm_externtype_vec_t623* \brief A list of #wasm_externtype_t values.624*625* \var wasm_externtype_vec_t::size626* \brief Length of this vector.627*628* \var wasm_externtype_vec_t::data629* \brief Pointer to the base of this vector630*631* \typedef wasm_externtype_vec_t632* \brief Convenience alias for #wasm_externtype_vec_t633*634* \fn void wasm_externtype_delete(wasm_externtype_t *);635* \brief Deletes a type.636*637* \fn void wasm_externtype_vec_new_empty(wasm_externtype_vec_t *out);638* \brief Creates an empty vector.639*640* See #wasm_byte_vec_new_empty for more information.641*642* \fn void wasm_externtype_vec_new_uninitialized(wasm_externtype_vec_t *out, size_t);643* \brief Creates a vector with the given capacity.644*645* See #wasm_byte_vec_new_uninitialized for more information.646*647* \fn void wasm_externtype_vec_new(wasm_externtype_vec_t *out, size_t, wasm_externtype_t *const[]);648* \brief Creates a vector with the provided contents.649*650* See #wasm_byte_vec_new for more information.651*652* \fn void wasm_externtype_vec_copy(wasm_externtype_vec_t *out, const wasm_externtype_vec_t *)653* \brief Copies one vector to another654*655* See #wasm_byte_vec_copy for more information.656*657* \fn void wasm_externtype_vec_delete(wasm_externtype_vec_t *out)658* \brief Deallocates extern for a vector.659*660* See #wasm_byte_vec_delete for more information.661*662* \fn wasm_externtype_t* wasm_externtype_copy(const wasm_externtype_t *)663* \brief Creates a new value which matches the provided one.664*665* The caller is responsible for deleting the returned value.666*667* \fn wasm_externkind_t wasm_externtype_kind(const wasm_externtype_t *)668* \brief Returns the kind of external item this type represents.669*/670671/**672* \typedef wasm_externkind_t673* \brief Classifier for #wasm_externtype_t674*675* This is returned from #wasm_extern_kind and #wasm_externtype_kind to676* determine what kind of type is wrapped.677*/678679/**680* \fn wasm_externtype_t* wasm_functype_as_externtype(wasm_functype_t *)681* \brief Converts a #wasm_functype_t to a #wasm_externtype_t682*683* The returned value is owned by the #wasm_functype_t argument and should not684* be deleted.685*686* \fn wasm_externtype_t* wasm_tabletype_as_externtype(wasm_tabletype_t *)687* \brief Converts a #wasm_tabletype_t to a #wasm_externtype_t688*689* The returned value is owned by the #wasm_tabletype_t argument and should not690* be deleted.691*692* \fn wasm_externtype_t* wasm_globaltype_as_externtype(wasm_globaltype_t *)693* \brief Converts a #wasm_globaltype_t to a #wasm_externtype_t694*695* The returned value is owned by the #wasm_globaltype_t argument and should not696* be deleted.697*698* \fn wasm_externtype_t* wasm_memorytype_as_externtype(wasm_memorytype_t *)699* \brief Converts a #wasm_memorytype_t to a #wasm_externtype_t700*701* The returned value is owned by the #wasm_memorytype_t argument and should not702* be deleted.703*704* \fn const wasm_externtype_t* wasm_functype_as_externtype_const(const wasm_functype_t *)705* \brief Converts a #wasm_functype_t to a #wasm_externtype_t706*707* The returned value is owned by the #wasm_functype_t argument and should not708* be deleted.709*710* \fn const wasm_externtype_t* wasm_tabletype_as_externtype_const(const wasm_tabletype_t *)711* \brief Converts a #wasm_tabletype_t to a #wasm_externtype_t712*713* The returned value is owned by the #wasm_tabletype_t argument and should not714* be deleted.715*716* \fn const wasm_externtype_t* wasm_globaltype_as_externtype_const(const wasm_globaltype_t *)717* \brief Converts a #wasm_globaltype_t to a #wasm_externtype_t718*719* The returned value is owned by the #wasm_globaltype_t argument and should not720* be deleted.721*722* \fn const wasm_externtype_t* wasm_memorytype_as_externtype_const(const wasm_memorytype_t *)723* \brief Converts a #wasm_memorytype_t to a #wasm_externtype_t724*725* The returned value is owned by the #wasm_memorytype_t argument and should not726* be deleted.727*728* \fn wasm_functype_t* wasm_externtype_as_functype(wasm_externtype_t *)729* \brief Attempts to convert a #wasm_externtype_t to a #wasm_functype_t730*731* The returned value is owned by the #wasm_functype_t argument and should not732* be deleted. Returns `NULL` if the provided argument is not a733* #wasm_functype_t.734*735* \fn wasm_tabletype_t* wasm_externtype_as_tabletype(wasm_externtype_t *)736* \brief Attempts to convert a #wasm_externtype_t to a #wasm_tabletype_t737*738* The returned value is owned by the #wasm_tabletype_t argument and should not739* be deleted. Returns `NULL` if the provided argument is not a740* #wasm_tabletype_t.741*742* \fn wasm_memorytype_t* wasm_externtype_as_memorytype(wasm_externtype_t *)743* \brief Attempts to convert a #wasm_externtype_t to a #wasm_memorytype_t744*745* The returned value is owned by the #wasm_memorytype_t argument and should not746* be deleted. Returns `NULL` if the provided argument is not a747* #wasm_memorytype_t.748*749* \fn wasm_globaltype_t* wasm_externtype_as_globaltype(wasm_externtype_t *)750* \brief Attempts to convert a #wasm_externtype_t to a #wasm_globaltype_t751*752* The returned value is owned by the #wasm_globaltype_t argument and should not753* be deleted. Returns `NULL` if the provided argument is not a754* #wasm_globaltype_t.755*756* \fn const wasm_functype_t* wasm_externtype_as_functype_const(const wasm_externtype_t *)757* \brief Attempts to convert a #wasm_externtype_t to a #wasm_functype_t758*759* The returned value is owned by the #wasm_functype_t argument and should not760* be deleted. Returns `NULL` if the provided argument is not a761* #wasm_functype_t.762*763* \fn const wasm_tabletype_t* wasm_externtype_as_tabletype_const(const wasm_externtype_t *)764* \brief Attempts to convert a #wasm_externtype_t to a #wasm_tabletype_t765*766* The returned value is owned by the #wasm_tabletype_t argument and should not767* be deleted. Returns `NULL` if the provided argument is not a768* #wasm_tabletype_t.769*770* \fn const wasm_memorytype_t* wasm_externtype_as_memorytype_const(const wasm_externtype_t *)771* \brief Attempts to convert a #wasm_externtype_t to a #wasm_memorytype_t772*773* The returned value is owned by the #wasm_memorytype_t argument and should not774* be deleted. Returns `NULL` if the provided argument is not a775* #wasm_memorytype_t.776*777* \fn const wasm_globaltype_t* wasm_externtype_as_globaltype_const(const wasm_externtype_t *)778* \brief Attempts to convert a #wasm_externtype_t to a #wasm_globaltype_t779*780* The returned value is owned by the #wasm_globaltype_t argument and should not781* be deleted. Returns `NULL` if the provided argument is not a782* #wasm_globaltype_t.783*/784785/**786* \struct wasm_importtype_t787* \brief An opaque object representing the type of an import.788*789* \typedef wasm_importtype_t790* \brief Convenience alias for #wasm_importtype_t791*792* \struct wasm_importtype_vec_t793* \brief A list of #wasm_importtype_t values.794*795* \var wasm_importtype_vec_t::size796* \brief Length of this vector.797*798* \var wasm_importtype_vec_t::data799* \brief Pointer to the base of this vector800*801* \typedef wasm_importtype_vec_t802* \brief Convenience alias for #wasm_importtype_vec_t803*804* \fn void wasm_importtype_delete(wasm_importtype_t *);805* \brief Deletes a type.806*807* \fn void wasm_importtype_vec_new_empty(wasm_importtype_vec_t *out);808* \brief Creates an empty vector.809*810* See #wasm_byte_vec_new_empty for more information.811*812* \fn void wasm_importtype_vec_new_uninitialized(wasm_importtype_vec_t *out, size_t);813* \brief Creates a vector with the given capacity.814*815* See #wasm_byte_vec_new_uninitialized for more information.816*817* \fn void wasm_importtype_vec_new(wasm_importtype_vec_t *out, size_t, wasm_importtype_t *const[]);818* \brief Creates a vector with the provided contents.819*820* See #wasm_byte_vec_new for more information.821*822* \fn void wasm_importtype_vec_copy(wasm_importtype_vec_t *out, const wasm_importtype_vec_t *)823* \brief Copies one vector to another824*825* See #wasm_byte_vec_copy for more information.826*827* \fn void wasm_importtype_vec_delete(wasm_importtype_vec_t *out)828* \brief Deallocates import for a vector.829*830* See #wasm_byte_vec_delete for more information.831*832* \fn wasm_importtype_t* wasm_importtype_copy(const wasm_importtype_t *)833* \brief Creates a new value which matches the provided one.834*835* The caller is responsible for deleting the returned value.836*837* \fn wasm_importtype_t* wasm_importtype_new(wasm_name_t *module, wasm_name_t *name, wasm_externtype_t *)838* \brief Creates a new import type.839*840* This function takes ownership of the `module`, `name`, and841* #wasm_externtype_t arguments. The caller is responsible for deleting the842* returned value. Note that `name` can be `NULL` where in the module linking843* proposal the import name can be omitted.844*845* \fn const wasm_name_t* wasm_importtype_module(const wasm_importtype_t *);846* \brief Returns the module this import is importing from.847*848* The returned memory is owned by the #wasm_importtype_t argument, the caller849* should not deallocate it.850*851* \fn const wasm_name_t* wasm_importtype_name(const wasm_importtype_t *);852* \brief Returns the name this import is importing from.853*854* The returned memory is owned by the #wasm_importtype_t argument, the caller855* should not deallocate it. Note that `NULL` can be returned which means856* that the import name is not provided. This is for imports with the module857* linking proposal that only have the module specified.858*859* \fn const wasm_externtype_t* wasm_importtype_type(const wasm_importtype_t *);860* \brief Returns the type of item this import is importing.861*862* The returned memory is owned by the #wasm_importtype_t argument, the caller863* should not deallocate it.864*/865866/**867* \struct wasm_exporttype_t868* \brief An opaque object representing the type of an export.869*870* \typedef wasm_exporttype_t871* \brief Convenience alias for #wasm_exporttype_t872*873* \struct wasm_exporttype_vec_t874* \brief A list of #wasm_exporttype_t values.875*876* \var wasm_exporttype_vec_t::size877* \brief Length of this vector.878*879* \var wasm_exporttype_vec_t::data880* \brief Pointer to the base of this vector881*882* \typedef wasm_exporttype_vec_t883* \brief Convenience alias for #wasm_exporttype_vec_t884*885* \fn void wasm_exporttype_delete(wasm_exporttype_t *);886* \brief Deletes a type.887*888* \fn void wasm_exporttype_vec_new_empty(wasm_exporttype_vec_t *out);889* \brief Creates an empty vector.890*891* See #wasm_byte_vec_new_empty for more information.892*893* \fn void wasm_exporttype_vec_new_uninitialized(wasm_exporttype_vec_t *out, size_t);894* \brief Creates a vector with the given capacity.895*896* See #wasm_byte_vec_new_uninitialized for more information.897*898* \fn void wasm_exporttype_vec_new(wasm_exporttype_vec_t *out, size_t, wasm_exporttype_t *const[]);899* \brief Creates a vector with the provided contents.900*901* See #wasm_byte_vec_new for more information.902*903* \fn void wasm_exporttype_vec_copy(wasm_exporttype_vec_t *out, const wasm_exporttype_vec_t *)904* \brief Copies one vector to another905*906* See #wasm_byte_vec_copy for more information.907*908* \fn void wasm_exporttype_vec_delete(wasm_exporttype_vec_t *out)909* \brief Deallocates export for a vector.910*911* See #wasm_byte_vec_delete for more information.912*913* \fn wasm_exporttype_t* wasm_exporttype_copy(const wasm_exporttype_t *)914* \brief Creates a new value which matches the provided one.915*916* The caller is responsible for deleting the returned value.917*918* \fn wasm_exporttype_t* wasm_exporttype_new(wasm_name_t *name, wasm_externtype_t *)919* \brief Creates a new export type.920*921* This function takes ownership of the `name` and922* #wasm_externtype_t arguments. The caller is responsible for deleting the923* returned value.924*925* \fn const wasm_name_t* wasm_exporttype_name(const wasm_exporttype_t *);926* \brief Returns the name of this export.927*928* The returned memory is owned by the #wasm_exporttype_t argument, the caller929* should not deallocate it.930*931* \fn const wasm_externtype_t* wasm_exporttype_type(const wasm_exporttype_t *);932* \brief Returns the type of this export.933*934* The returned memory is owned by the #wasm_exporttype_t argument, the caller935* should not deallocate it.936*/937938/**939* \struct wasm_val_t940* \brief Representation of a WebAssembly value.941*942* Note that this structure is intended to represent the way to communicate943* values from the embedder to the engine. This type is not actually the944* internal representation in JIT code, for example.945*946* Also note that this is an owned value, notably the `ref` field. The947* #wasm_val_delete function does not delete the memory holding the #wasm_val_t948* itself, but only the memory pointed to by #wasm_val_t.949*950* \var wasm_val_t::kind951* \brief The kind of this value, or which of the fields in the `of` payload952* contains the actual value.953*954* \var wasm_val_t::of955* \brief The actual value of this #wasm_val_t. Only one field of this956* anonymous union is valid, and which field is valid is defined by the `kind`957* field.958*959* \var wasm_val_t::@0::i32960* \brief value for the `WASM_I32` type961*962* \var wasm_val_t::@0::i64963* \brief value for the `WASM_I64` type964*965* \var wasm_val_t::@0::f32966* \brief value for the `WASM_F32` type967*968* \var wasm_val_t::@0::f64969* \brief value for the `WASM_F64` type970*971* \var wasm_val_t::@0::ref972* \brief Unused by Wasmtime.973*974* \typedef wasm_val_t975* \brief Convenience alias for #wasm_val_t976*977* \struct wasm_val_vec_t978* \brief A list of #wasm_val_t values.979*980* \var wasm_val_vec_t::size981* \brief Length of this vector.982*983* \var wasm_val_vec_t::data984* \brief Pointer to the base of this vector985*986* \typedef wasm_val_vec_t987* \brief Convenience alias for #wasm_val_vec_t988*989* \fn void wasm_val_delete(wasm_val_t *v);990* \brief Deletes a type.991*992* This does not delete the memory pointed to by `v`, so it's safe for `v` to993* reside on the stack. Instead this only deletes the memory referenced by `v`,994* such as the `ref` variant of #wasm_val_t.995*996* \fn void wasm_val_vec_new_empty(wasm_val_vec_t *out);997* \brief Creates an empty vector.998*999* See #wasm_byte_vec_new_empty for more information.1000*1001* \fn void wasm_val_vec_new_uninitialized(wasm_val_vec_t *out, size_t);1002* \brief Creates a vector with the given capacity.1003*1004* See #wasm_byte_vec_new_uninitialized for more information.1005*1006* \fn void wasm_val_vec_new(wasm_val_vec_t *out, size_t, wasm_val_t const[]);1007* \brief Creates a vector with the provided contents.1008*1009* See #wasm_byte_vec_new for more information.1010*1011* \fn void wasm_val_vec_copy(wasm_val_vec_t *out, const wasm_val_vec_t *)1012* \brief Copies one vector to another1013*1014* See #wasm_byte_vec_copy for more information.1015*1016* \fn void wasm_val_vec_delete(wasm_val_vec_t *out)1017* \brief Deallocates export for a vector.1018*1019* See #wasm_byte_vec_delete for more information.1020*1021* \fn void wasm_val_copy(wasm_val_t *out, const wasm_val_t *)1022* \brief Copies a #wasm_val_t to a new one.1023*1024* The second argument to this function is copied to the first. The caller is1025* responsible for calling #wasm_val_delete on the first argument after this1026* function. The `out` parameter is assumed uninitialized by this function and1027* the previous contents will not be deallocated.1028*/10291030/**1031* \struct wasm_ref_t1032* \brief A reference type: either a funcref or an externref.1033*1034* \typedef wasm_ref_t1035* \brief Convenience alias for #wasm_ref_t1036*1037* \fn void wasm_ref_delete(wasm_ref_t *v);1038* \brief Delete a reference.1039*1040* \fn wasm_ref_t *wasm_ref_copy(const wasm_ref_t *)1041* \brief Copy a reference.1042*1043* \fn bool wasm_ref_same(const wasm_ref_t *, const wasm_ref_t *)1044* \brief Are the given references pointing to the same externref?1045*1046* > Note: Wasmtime does not support checking funcrefs for equality, and this1047* > function will always return false for funcrefs.1048*1049* \fn void* wasm_ref_get_host_info(const wasm_ref_t *);1050* \brief Unimplemented in Wasmtime, always returns `NULL`.1051*1052* \fn void wasm_ref_set_host_info(wasm_ref_t *, void *);1053* \brief Unimplemented in Wasmtime, aborts the process if called.1054*1055* \fn void wasm_ref_set_host_info_with_finalizer(wasm_ref_t *, void *, void(*)(void*));1056* \brief Unimplemented in Wasmtime, aborts the process if called.1057*/10581059/**1060* \struct wasm_frame_t1061* \brief Opaque struct representing a frame of a wasm stack trace.1062*1063* \typedef wasm_frame_t1064* \brief Convenience alias for #wasm_frame_t1065*1066* \struct wasm_frame_vec_t1067* \brief A list of #wasm_frame_t frameues.1068*1069* \var wasm_frame_vec_t::size1070* \brief Length of this vector.1071*1072* \var wasm_frame_vec_t::data1073* \brief Pointer to the base of this vector1074*1075* \typedef wasm_frame_vec_t1076* \brief Convenience alias for #wasm_frame_vec_t1077*1078* \fn void wasm_frame_delete(wasm_frame_t *v);1079* \brief Deletes a frame.1080*1081* \fn void wasm_frame_vec_new_empty(wasm_frame_vec_t *out);1082* \brief Creates an empty vector.1083*1084* See #wasm_byte_vec_new_empty for more information.1085*1086* \fn void wasm_frame_vec_new_uninitialized(wasm_frame_vec_t *out, size_t);1087* \brief Creates a vector with the given capacity.1088*1089* See #wasm_byte_vec_new_uninitialized for more information.1090*1091* \fn void wasm_frame_vec_new(wasm_frame_vec_t *out, size_t, wasm_frame_t *const[]);1092* \brief Creates a vector with the provided contents.1093*1094* See #wasm_byte_vec_new for more information.1095*1096* \fn void wasm_frame_vec_copy(wasm_frame_vec_t *out, const wasm_frame_vec_t *)1097* \brief Copies one vector to another1098*1099* See #wasm_byte_vec_copy for more information.1100*1101* \fn void wasm_frame_vec_delete(wasm_frame_vec_t *out)1102* \brief Deallocates export for a vector.1103*1104* See #wasm_byte_vec_delete for more information.1105*1106* \fn wasm_frame_t *wasm_frame_copy(const wasm_frame_t *)1107* \brief Returns a copy of the provided frame.1108*1109* The caller is expected to call #wasm_frame_delete on the returned frame.1110*1111* \fn wasm_instance_t *wasm_frame_instance(const wasm_frame_t *);1112* \brief Unimplemented in Wasmtime, aborts the process if called.1113*1114* \fn uint32_t wasm_frame_func_index(const wasm_frame_t *);1115* \brief Returns the function index in the original wasm module that this frame1116* corresponds to.1117*1118* \fn uint32_t wasm_frame_func_offset(const wasm_frame_t *);1119* \brief Returns the byte offset from the beginning of the function in the1120* original wasm file to the instruction this frame points to.1121*1122* \fn uint32_t wasm_frame_module_offset(const wasm_frame_t *);1123* \brief Returns the byte offset from the beginning of the original wasm file1124* to the instruction this frame points to.1125*/11261127/**1128* \struct wasm_trap_t1129* \brief Opaque struct representing a wasm trap.1130*1131* \typedef wasm_trap_t1132* \brief Convenience alias for #wasm_trap_t1133*1134* \fn void wasm_trap_delete(wasm_trap_t *v);1135* \brief Deletes a trap.1136*1137* \fn wasm_trap_t *wasm_trap_copy(const wasm_trap_t *)1138* \brief Copies a #wasm_trap_t to a new one.1139*1140* The caller is responsible for deleting the returned #wasm_trap_t.1141*1142* \fn void wasm_trap_same(const wasm_trap_t *, const wasm_trap_t *)1143* \brief Unimplemented in Wasmtime, aborts the process if called.1144*1145* \fn void* wasm_trap_get_host_info(const wasm_trap_t *);1146* \brief Unimplemented in Wasmtime, always returns `NULL`.1147*1148* \fn void wasm_trap_set_host_info(wasm_trap_t *, void *);1149* \brief Unimplemented in Wasmtime, aborts the process if called.1150*1151* \fn void wasm_trap_set_host_info_with_finalizer(wasm_trap_t *, void *, void(*)(void*));1152* \brief Unimplemented in Wasmtime, aborts the process if called.1153*1154* \fn wasm_ref_t *wasm_trap_as_ref(wasm_trap_t *);1155* \brief Unimplemented in Wasmtime, aborts the process if called.1156*1157* \fn wasm_trap_t *wasm_ref_as_trap(wasm_ref_t *);1158* \brief Unimplemented in Wasmtime, aborts the process if called.1159*1160* \fn const wasm_ref_t *wasm_trap_as_ref_const(const wasm_trap_t *);1161* \brief Unimplemented in Wasmtime, aborts the process if called.1162*1163* \fn const wasm_trap_t *wasm_ref_as_trap_const(const wasm_ref_t *);1164* \brief Unimplemented in Wasmtime, aborts the process if called.1165*1166* \fn wasm_trap_t *wasm_trap_new(wasm_store_t *store, const wasm_message_t *);1167* \brief Creates a new #wasm_trap_t with the provided message.1168*1169* This function will create a new trap within the given #wasm_store_t with the1170* provided message. This will also capture the backtrace, if any, of wasm1171* frames on the stack.1172*1173* Note that the #wasm_message_t argument is expected to have a 0-byte at the1174* end of the message, and the length should include the trailing 0-byte.1175*1176* This function does not take ownership of either argument.1177*1178* The caller is responsible for deallocating the trap returned.1179*1180* \fn void wasm_trap_message(const wasm_trap_t *, wasm_message_t *out);1181* \brief Retrieves the message associated with this trap.1182*1183* The caller takes ownership of the returned `out` value and is responsible for1184* calling #wasm_byte_vec_delete on it.1185*1186* \fn wasm_frame_t* wasm_trap_origin(const wasm_trap_t *);1187* \brief Returns the top frame of the wasm stack responsible for this trap.1188*1189* The caller is responsible for deallocating the returned frame. This function1190* may return `NULL`, for example, for traps created when there wasn't anything1191* on the wasm stack.1192*1193* \fn void wasm_trap_trace(const wasm_trap_t *, wasm_frame_vec_t *out);1194* \brief Returns the trace of wasm frames for this trap.1195*1196* The caller is responsible for deallocating the returned list of frames.1197* Frames are listed in order of increasing depth, with the most recently called1198* function at the front of the list and the base function on the stack at the1199* end.1200*/12011202/**1203* \struct wasm_foreign_t1204* \brief Unimplemented in Wasmtime1205*1206* \typedef wasm_foreign_t1207* \brief Convenience alias for #wasm_foreign_t1208*1209* \fn void wasm_foreign_delete(wasm_foreign_t *v);1210* \brief Unimplemented in Wasmtime, aborts the process if called1211*1212* \fn wasm_foreign_t *wasm_foreign_copy(const wasm_foreign_t *)1213* \brief Unimplemented in Wasmtime, aborts the process if called1214*1215* \fn void wasm_foreign_same(const wasm_foreign_t *, const wasm_foreign_t *)1216* \brief Unimplemented in Wasmtime, aborts the process if called.1217*1218* \fn void* wasm_foreign_get_host_info(const wasm_foreign_t *);1219* \brief Unimplemented in Wasmtime, always returns `NULL`.1220*1221* \fn void wasm_foreign_set_host_info(wasm_foreign_t *, void *);1222* \brief Unimplemented in Wasmtime, aborts the process if called.1223*1224* \fn void wasm_foreign_set_host_info_with_finalizer(wasm_foreign_t *, void *, void(*)(void*));1225* \brief Unimplemented in Wasmtime, aborts the process if called.1226*1227* \fn wasm_ref_t *wasm_foreign_as_ref(wasm_foreign_t *);1228* \brief Unimplemented in Wasmtime, aborts the process if called.1229*1230* \fn wasm_foreign_t *wasm_ref_as_foreign(wasm_ref_t *);1231* \brief Unimplemented in Wasmtime, aborts the process if called.1232*1233* \fn const wasm_ref_t *wasm_foreign_as_ref_const(const wasm_foreign_t *);1234* \brief Unimplemented in Wasmtime, aborts the process if called.1235*1236* \fn const wasm_foreign_t *wasm_ref_as_foreign_const(const wasm_ref_t *);1237* \brief Unimplemented in Wasmtime, aborts the process if called.1238*1239* \fn wasm_foreign_t *wasm_foreign_new(wasm_store_t *store);1240* \brief Unimplemented in Wasmtime, aborts the process if called.1241*/12421243/**1244* \struct wasm_module_t1245* \brief Opaque struct representing a compiled wasm module.1246*1247* This structure is safe to send across threads in Wasmtime.1248*1249* \typedef wasm_module_t1250* \brief Convenience alias for #wasm_module_t1251*1252* \struct wasm_shared_module_t1253* \brief Opaque struct representing module that can be sent between threads.1254*1255* This structure is safe to send across threads in Wasmtime. Note that in1256* Wasmtime #wasm_module_t is also safe to share across threads.1257*1258* \typedef wasm_shared_module_t1259* \brief Convenience alias for #wasm_shared_module_t1260*1261* \fn void wasm_module_delete(wasm_module_t *v);1262* \brief Deletes a module.1263*1264* \fn wasm_module_t *wasm_module_copy(const wasm_module_t *)1265* \brief Copies a #wasm_module_t to a new one.1266*1267* The caller is responsible for deleting the returned #wasm_module_t.1268*1269* \fn void wasm_module_same(const wasm_module_t *, const wasm_module_t *)1270* \brief Unimplemented in Wasmtime, aborts the process if called.1271*1272* \fn void* wasm_module_get_host_info(const wasm_module_t *);1273* \brief Unimplemented in Wasmtime, always returns `NULL`.1274*1275* \fn void wasm_module_set_host_info(wasm_module_t *, void *);1276* \brief Unimplemented in Wasmtime, aborts the process if called.1277*1278* \fn void wasm_module_set_host_info_with_finalizer(wasm_module_t *, void *, void(*)(void*));1279* \brief Unimplemented in Wasmtime, aborts the process if called.1280*1281* \fn wasm_ref_t *wasm_module_as_ref(wasm_module_t *);1282* \brief Unimplemented in Wasmtime, aborts the process if called.1283*1284* \fn wasm_module_t *wasm_ref_as_module(wasm_ref_t *);1285* \brief Unimplemented in Wasmtime, aborts the process if called.1286*1287* \fn const wasm_ref_t *wasm_module_as_ref_const(const wasm_module_t *);1288* \brief Unimplemented in Wasmtime, aborts the process if called.1289*1290* \fn const wasm_module_t *wasm_ref_as_module_const(const wasm_ref_t *);1291* \brief Unimplemented in Wasmtime, aborts the process if called.1292*1293* \fn wasm_ref_as_module_const(const wasm_ref_t *);1294* \brief Unimplemented in Wasmtime, aborts the process if called.1295*1296* \fn void wasm_shared_module_delete(wasm_shared_module_t *);1297* \brief Deletes the provided module.1298*1299* \fn wasm_shared_module_t *wasm_module_share(const wasm_module_t *);1300* \brief Creates a shareable module from the provided module.1301*1302* > Note that this API is not necessary in Wasmtime because #wasm_module_t can1303* > be shared across threads. This is implemented for compatibility, however.1304*1305* This function does not take ownership of the argument, but the caller is1306* expected to deallocate the returned #wasm_shared_module_t.1307*1308* \fn wasm_module_t *wasm_module_obtain(wasm_store_t *, const wasm_shared_module_t *);1309* \brief Attempts to create a #wasm_module_t from the shareable module.1310*1311* > Note that this API is not necessary in Wasmtime because #wasm_module_t can1312* > be shared across threads. This is implemented for compatibility, however.1313*1314* This function does not take ownership of its arguments, but the caller is1315* expected to deallocate the returned #wasm_module_t.1316*1317* This function may fail if the engines associated with the #wasm_store_t or1318* #wasm_shared_module_t are different.1319*1320* \fn wasm_module_t *wasm_module_new(wasm_store_t *, const wasm_byte_vec_t *binary)1321* \brief Compiles a raw WebAssembly binary to a #wasm_module_t.1322*1323* This function will validate and compile the provided binary. The returned1324* #wasm_module_t is ready for instantiation after this call returns.1325*1326* This function does not take ownership of its arguments, but the caller is1327* expected to deallocate the returned #wasm_module_t.1328*1329* This function may fail if the provided binary is not a WebAssembly binary or1330* if it does not pass validation. In these cases this function returns `NULL`.1331*1332* \fn bool wasm_module_validate(wasm_store_t *, const wasm_byte_vec_t *binary);1333* \brief Validates whether a provided byte sequence is a valid wasm binary.1334*1335* This function will perform any internal validation necessary to determine if1336* `binary` is a valid WebAssembly binary according to the configuration of the1337* #wasm_store_t provided.1338*1339* \fn void wasm_module_imports(const wasm_module_t *, wasm_importtype_vec_t *out);1340* \brief Returns the list of imports that this module expects.1341*1342* The list of imports returned are the types of items expected to be passed to1343* #wasm_instance_new. You can use #wasm_importtype_type to learn about the1344* expected type of each import.1345*1346* This function does not take ownership of the provided module but ownership of1347* `out` is passed to the caller. Note that `out` is treated as uninitialized1348* when passed to this function.1349*1350* \fn void wasm_module_exports(const wasm_module_t *, wasm_exporttype_vec_t *out);1351* \brief Returns the list of exports that this module provides.1352*1353* The list of exports returned are in the same order as the items returned by1354* #wasm_instance_exports.1355*1356* This function does not take ownership of the provided module but ownership1357* of `out` is passed to the caller. Note that `out` is treated as1358* uninitialized when passed to this function.1359*1360* \fn void wasm_module_serialize(const wasm_module_t *, wasm_byte_vec_t *out);1361* \brief Serializes the provided module to a byte vector.1362*1363* Does not take ownership of the input module but expects the caller will1364* deallocate the `out` vector. The byte vector can later be deserialized1365* through #wasm_module_deserialize.1366*1367* \fn wasm_module_t *wasm_module_deserialize(wasm_store_t *, const wasm_byte_vec_t *);1368* \brief Deserializes a previously-serialized module.1369*1370* The input bytes must have been created from a previous call to1371* #wasm_module_serialize.1372*/13731374/**1375* \struct wasm_func_t1376* \brief Opaque struct representing a compiled wasm function.1377*1378* \typedef wasm_func_t1379* \brief Convenience alias for #wasm_func_t1380*1381* \typedef wasm_func_callback_t1382* \brief Type definition for functions passed to #wasm_func_new.1383*1384* This is the type signature of a host function created with #wasm_func_new.1385* This function takes two parameters, the first of which is the list of1386* parameters to the function and the second of which is where to write the1387* results. This function can optionally return a #wasm_trap_t and does not have1388* to fill in the results in that case.1389*1390* It is guaranteed that this function will be called with the appropriate1391* number and types of arguments according to the function type passed to1392* #wasm_func_new. It is required that this function produces the correct number1393* and types of results as the original type signature. It is undefined behavior1394* to return other types or different numbers of values.1395*1396* Ownership of the results and the trap returned, if any, is passed to the1397* caller of this function.1398*1399* \typedef wasm_func_callback_with_env_t1400* \brief Type definition for functions passed to #wasm_func_new_with_env1401*1402* The semantics of this function are the same as those of1403* #wasm_func_callback_t, except the first argument is the same `void*` argument1404* passed to #wasm_func_new_with_env.1405*1406* \fn void wasm_func_delete(wasm_func_t *v);1407* \brief Deletes a func.1408*1409* \fn wasm_func_t *wasm_func_copy(const wasm_func_t *)1410* \brief Copies a #wasm_func_t to a new one.1411*1412* The caller is responsible for deleting the returned #wasm_func_t.1413*1414* \fn void wasm_func_same(const wasm_func_t *, const wasm_func_t *)1415* \brief Unimplemented in Wasmtime, aborts the process if called.1416*1417* \fn void* wasm_func_get_host_info(const wasm_func_t *);1418* \brief Unimplemented in Wasmtime, always returns `NULL`.1419*1420* \fn void wasm_func_set_host_info(wasm_func_t *, void *);1421* \brief Unimplemented in Wasmtime, aborts the process if called.1422*1423* \fn void wasm_func_set_host_info_with_finalizer(wasm_func_t *, void *, void(*)(void*));1424* \brief Unimplemented in Wasmtime, aborts the process if called.1425*1426* \fn wasm_ref_t *wasm_func_as_ref(wasm_func_t *);1427* \brief Unimplemented in Wasmtime, aborts the process if called.1428*1429* \fn wasm_func_t *wasm_ref_as_func(wasm_ref_t *);1430* \brief Unimplemented in Wasmtime, aborts the process if called.1431*1432* \fn const wasm_ref_t *wasm_func_as_ref_const(const wasm_func_t *);1433* \brief Unimplemented in Wasmtime, aborts the process if called.1434*1435* \fn const wasm_func_t *wasm_ref_as_func_const(const wasm_ref_t *);1436* \brief Unimplemented in Wasmtime, aborts the process if called.1437*1438* \fn wasm_ref_as_func_const(const wasm_ref_t *);1439* \brief Unimplemented in Wasmtime, aborts the process if called.1440*1441* \fn wasm_func_t *wasm_func_new(wasm_store_t *, const wasm_functype_t *, wasm_func_callback_t);1442* \brief Creates a new WebAssembly function with host functionality.1443*1444* This function creates a new #wasm_func_t from a host-provided function. The1445* host provided function must implement the type signature matching the1446* #wasm_functype_t provided here.1447*1448* The returned #wasm_func_t is expected to be deleted by the caller. This1449* function does not take ownership of its arguments.1450*1451* \fn wasm_func_t *wasm_func_new_with_env(1452* wasm_store_t *,1453* const wasm_functype_t *type,1454* wasm_func_callback_with_env_t,1455* void *env,1456* void (*finalizer)(void *));1457* \brief Creates a new WebAssembly function with host functionality.1458*1459* This function is the same as #wasm_func_new except that it the host-provided1460* `env` argument is passed to each invocation of the callback provided. This1461* provides a means of attaching host information to this #wasm_func_t.1462*1463* The `finalizer` argument will be invoked to deallocate `env` when the1464* #wasm_func_t is deallocated. If this argument is `NULL` then the data1465* provided will not be finalized.1466*1467* This function only takes ownership of the `env` argument (which is later1468* deallocated automatically by calling `finalizer`). This function yields1469* ownership of the returned #wasm_func_t to the caller.1470*1471* \fn wasm_functype_t *wasm_func_type(const wasm_func_t *);1472* \brief Returns the type of this function.1473*1474* The returned #wasm_functype_t is expected to be deallocated by the caller.1475*1476* \fn size_t wasm_func_param_arity(const wasm_func_t *);1477* \brief Returns the number of arguments expected by this function.1478*1479* \fn size_t wasm_func_result_arity(const wasm_func_t *);1480* \brief Returns the number of results returned by this function.1481*1482* \fn wasm_trap_t *wasm_func_call(const wasm_func_t *, const wasm_val_vec_t *args, wasm_val_vec_t *results);1483* \brief Calls the provided function with the arguments given.1484*1485* This function is used to call WebAssembly from the host. The parameter array1486* provided must be valid for #wasm_func_param_arity number of arguments, and1487* the result array must be valid for #wasm_func_result_arity number of results.1488* Providing not enough space is undefined behavior.1489*1490* If any of the arguments do not have the correct type then a trap is returned.1491* Additionally if any of the arguments come from a different store than1492* the #wasm_func_t provided a trap is returned.1493*1494* When no trap happens and no errors are detected then `NULL` is returned. The1495* `results` array is guaranteed to be filled in with values appropriate for1496* this function's type signature.1497*1498* If a trap happens during execution or some other error then a non-`NULL` trap1499* is returned. In this situation the `results` are is unmodified.1500*1501* Does not take ownership of `wasm_val_t` arguments. Gives ownership of1502* `wasm_val_t` results.1503*/15041505/**1506* \struct wasm_global_t1507* \brief Opaque struct representing a wasm global.1508*1509* \typedef wasm_global_t1510* \brief Convenience alias for #wasm_global_t1511*1512* \fn void wasm_global_delete(wasm_global_t *v);1513* \brief Deletes a global.1514*1515* \fn wasm_global_t *wasm_global_copy(const wasm_global_t *)1516* \brief Copies a #wasm_global_t to a new one.1517*1518* The caller is responsible for deleting the returned #wasm_global_t.1519*1520* \fn void wasm_global_same(const wasm_global_t *, const wasm_global_t *)1521* \brief Unimplemented in Wasmtime, aborts the process if called.1522*1523* \fn void* wasm_global_get_host_info(const wasm_global_t *);1524* \brief Unimplemented in Wasmtime, always returns `NULL`.1525*1526* \fn void wasm_global_set_host_info(wasm_global_t *, void *);1527* \brief Unimplemented in Wasmtime, aborts the process if called.1528*1529* \fn void wasm_global_set_host_info_with_finalizer(wasm_global_t *, void *, void(*)(void*));1530* \brief Unimplemented in Wasmtime, aborts the process if called.1531*1532* \fn wasm_ref_t *wasm_global_as_ref(wasm_global_t *);1533* \brief Unimplemented in Wasmtime, aborts the process if called.1534*1535* \fn wasm_global_t *wasm_ref_as_global(wasm_ref_t *);1536* \brief Unimplemented in Wasmtime, aborts the process if called.1537*1538* \fn const wasm_ref_t *wasm_global_as_ref_const(const wasm_global_t *);1539* \brief Unimplemented in Wasmtime, aborts the process if called.1540*1541* \fn const wasm_global_t *wasm_ref_as_global_const(const wasm_ref_t *);1542* \brief Unimplemented in Wasmtime, aborts the process if called.1543*1544* \fn wasm_ref_as_global_const(const wasm_ref_t *);1545* \brief Unimplemented in Wasmtime, aborts the process if called.1546*1547* \fn wasm_global_t *wasm_global_new(wasm_store_t *, const wasm_globaltype_t *, const wasm_val_t *);1548* \brief Creates a new WebAssembly global.1549*1550* This function is used to create a wasm global from the host, typically to1551* provide as the import of a module. The type of the global is specified along1552* with the initial value.1553*1554* This function will return `NULL` on errors. Errors include:1555*1556* * The type of the global doesn't match the type of the value specified.1557* * The initialization value does not come from the provided #wasm_store_t.1558*1559* This function does not take ownership of any of its arguments. The caller is1560* expected to deallocate the returned value.1561*1562* \fn wasm_globaltype_t *wasm_global_type(const wasm_global_t *);1563* \brief Returns the type of this global.1564*1565* The caller is expected to deallocate the returned #wasm_globaltype_t.1566*1567* \fn void wasm_global_get(const wasm_global_t *, wasm_val_t *out);1568* \brief Gets the value of this global.1569*1570* The caller is expected to deallocate the returned #wasm_val_t. The provided1571* `out` argument is treated as uninitialized on input.1572*1573* \fn void wasm_global_set(wasm_global_t *, const wasm_val_t *);1574* \brief Sets the value of this global.1575*1576* This function will set the value of a global to a new value. This function1577* does nothing if the global is not mutable, if the #wasm_val_t argument has1578* the wrong type, or if the provided value comes from a different store as the1579* #wasm_global_t.1580*1581* This function does not take ownership of its arguments.1582*/15831584/**1585* \struct wasm_table_t1586* \brief Opaque struct representing a wasm table.1587*1588* \typedef wasm_table_t1589* \brief Convenience alias for #wasm_table_t1590*1591* \typedef wasm_table_size_t1592* \brief Typedef for indices and sizes of wasm tables.1593*1594* \fn void wasm_table_delete(wasm_table_t *v);1595* \brief Deletes a table.1596*1597* \fn wasm_table_t *wasm_table_copy(const wasm_table_t *)1598* \brief Copies a #wasm_table_t to a new one.1599*1600* The caller is responsible for deleting the returned #wasm_table_t.1601*1602* \fn void wasm_table_same(const wasm_table_t *, const wasm_table_t *)1603* \brief Unimplemented in Wasmtime, aborts the process if called.1604*1605* \fn void* wasm_table_get_host_info(const wasm_table_t *);1606* \brief Unimplemented in Wasmtime, always returns `NULL`.1607*1608* \fn void wasm_table_set_host_info(wasm_table_t *, void *);1609* \brief Unimplemented in Wasmtime, aborts the process if called.1610*1611* \fn void wasm_table_set_host_info_with_finalizer(wasm_table_t *, void *, void(*)(void*));1612* \brief Unimplemented in Wasmtime, aborts the process if called.1613*1614* \fn wasm_ref_t *wasm_table_as_ref(wasm_table_t *);1615* \brief Unimplemented in Wasmtime, aborts the process if called.1616*1617* \fn wasm_table_t *wasm_ref_as_table(wasm_ref_t *);1618* \brief Unimplemented in Wasmtime, aborts the process if called.1619*1620* \fn const wasm_ref_t *wasm_table_as_ref_const(const wasm_table_t *);1621* \brief Unimplemented in Wasmtime, aborts the process if called.1622*1623* \fn const wasm_table_t *wasm_ref_as_table_const(const wasm_ref_t *);1624* \brief Unimplemented in Wasmtime, aborts the process if called.1625*1626* \fn wasm_ref_as_table_const(const wasm_ref_t *);1627* \brief Unimplemented in Wasmtime, aborts the process if called.1628*1629* \fn wasm_table_t *wasm_table_new(wasm_store_t *, const wasm_tabletype_t *, wasm_ref_t *init);1630* \brief Creates a new WebAssembly table.1631*1632* Creates a new host-defined table of values. This table has the type provided1633* and is filled with the provided initial value (which can be `NULL`).1634*1635* Returns an error if the #wasm_ref_t does not match the element type of the1636* table provided or if it comes from a different store than the one provided.1637*1638* Does not take ownship of the `init` value.1639*1640* \fn wasm_tabletype_t *wasm_table_type(const wasm_table_t *);1641* \brief Returns the type of this table.1642*1643* The caller is expected to deallocate the returned #wasm_tabletype_t.1644*1645* \fn wasm_ref_t *wasm_table_get(const wasm_table_t *, wasm_table_size_t index);1646* \brief Gets an element from this table.1647*1648* Attempts to get a value at an index in this table. This function returns1649* `NULL` if the index is out of bounds.1650*1651* Gives ownership of the resulting `wasm_ref_t*`.1652*1653* \fn void wasm_table_set(wasm_table_t *, wasm_table_size_t index, wasm_ref_t *);1654* \brief Sets an element in this table.1655*1656* Attempts to set a value at an index in this table. This function does nothing1657* in erroneous situations such as:1658*1659* * The index is out of bounds.1660* * The #wasm_ref_t comes from a different store than the table provided.1661* * The #wasm_ref_t does not have an appropriate type to store in this table.1662*1663* Does not take ownership of the given `wasm_ref_t*`.1664*1665* \fn wasm_table_size_t wasm_table_size(const wasm_table_t *);1666* \brief Gets the current size, in elements, of this table.1667*1668* \fn bool wasm_table_grow(wasm_table_t *, wasm_table_size_t delta, wasm_ref_t *init);1669* \brief Attempts to grow this table by `delta` elements.1670*1671* This function will grow the table by `delta` elements, initializing all new1672* elements to the `init` value provided.1673*1674* If growth happens successfully, then `true` is returned. Otherwise `false` is1675* returned and indicates one possible form of failure:1676*1677* * The table's limits do not allow growth by `delta`.1678* * The #wasm_ref_t comes from a different store than the table provided.1679* * The #wasm_ref_t does not have an appropriate type to store in this table.1680*1681* Does not take ownership of the given `init` value.1682*/16831684/**1685* \struct wasm_memory_t1686* \brief Opaque struct representing a wasm memory.1687*1688* \typedef wasm_memory_t1689* \brief Convenience alias for #wasm_memory_t1690*1691* \typedef wasm_memory_pages_t1692* \brief Unsigned integer to hold the number of pages a memory has.1693*1694* \fn void wasm_memory_delete(wasm_memory_t *v);1695* \brief Deletes a memory.1696*1697* \fn wasm_memory_t *wasm_memory_copy(const wasm_memory_t *)1698* \brief Copies a #wasm_memory_t to a new one.1699*1700* The caller is responsible for deleting the returned #wasm_memory_t.1701*1702* \fn void wasm_memory_same(const wasm_memory_t *, const wasm_memory_t *)1703* \brief Unimplemented in Wasmtime, aborts the process if called.1704*1705* \fn void* wasm_memory_get_host_info(const wasm_memory_t *);1706* \brief Unimplemented in Wasmtime, always returns `NULL`.1707*1708* \fn void wasm_memory_set_host_info(wasm_memory_t *, void *);1709* \brief Unimplemented in Wasmtime, aborts the process if called.1710*1711* \fn void wasm_memory_set_host_info_with_finalizer(wasm_memory_t *, void *, void(*)(void*));1712* \brief Unimplemented in Wasmtime, aborts the process if called.1713*1714* \fn wasm_ref_t *wasm_memory_as_ref(wasm_memory_t *);1715* \brief Unimplemented in Wasmtime, aborts the process if called.1716*1717* \fn wasm_memory_t *wasm_ref_as_memory(wasm_ref_t *);1718* \brief Unimplemented in Wasmtime, aborts the process if called.1719*1720* \fn const wasm_ref_t *wasm_memory_as_ref_const(const wasm_memory_t *);1721* \brief Unimplemented in Wasmtime, aborts the process if called.1722*1723* \fn const wasm_memory_t *wasm_ref_as_memory_const(const wasm_ref_t *);1724* \brief Unimplemented in Wasmtime, aborts the process if called.1725*1726* \fn wasm_ref_as_memory_const(const wasm_ref_t *);1727* \brief Unimplemented in Wasmtime, aborts the process if called.1728*1729* \fn wasm_memory_t *wasm_memory_new(wasm_store_t *, const wasm_memorytype_t *);1730* \brief Creates a new WebAssembly memory.1731*1732* \fn wasm_memorytype_t *wasm_memory_type(const wasm_memory_t *);1733* \brief Returns the type of this memory.1734*1735* The caller is expected to deallocate the returned #wasm_memorytype_t.1736*1737* \fn byte_t *wasm_memory_data(wasm_memory_t *);1738* \brief Returns the base address, in memory, where this memory is located.1739*1740* Note that the returned address may change over time when growth happens. The1741* returned pointer is only valid until the memory is next grown (which could1742* happen in wasm itself).1743*1744* \fn size_t wasm_memory_data_size(const wasm_memory_t *);1745* \brief Returns the size, in bytes, of this memory.1746*1747* \fn wasm_memory_pages_t wasm_memory_size(const wasm_memory_t *);1748* \brief Returns the size, in wasm pages, of this memory.1749*1750* \fn bool wasm_memory_grow(wasm_memory_t *, wasm_memory_pages_t delta);1751* \brief Attempts to grow this memory by `delta` wasm pages.1752*1753* This function is similar to the `memory.grow` instruction in wasm itself. It1754* will attempt to grow the memory by `delta` wasm pages. If growth fails then1755* `false` is returned, otherwise `true` is returned.1756*/17571758/**1759* \struct wasm_extern_t1760* \brief Opaque struct representing a wasm external value.1761*1762* \typedef wasm_extern_t1763* \brief Convenience alias for #wasm_extern_t1764*1765* \struct wasm_extern_vec_t1766* \brief A list of #wasm_extern_t values.1767*1768* \var wasm_extern_vec_t::size1769* \brief Length of this vector.1770*1771* \var wasm_extern_vec_t::data1772* \brief Pointer to the base of this vector1773*1774* \typedef wasm_extern_vec_t1775* \brief Convenience alias for #wasm_extern_vec_t1776*1777* \fn void wasm_extern_delete(wasm_extern_t *v);1778* \brief Deletes a extern.1779*1780* \fn void wasm_extern_vec_new_empty(wasm_extern_vec_t *out);1781* \brief Creates an empty vector.1782*1783* See #wasm_byte_vec_new_empty for more information.1784*1785* \fn void wasm_extern_vec_new_uninitialized(wasm_extern_vec_t *out, size_t);1786* \brief Creates a vector with the given capacity.1787*1788* See #wasm_byte_vec_new_uninitialized for more information.1789*1790* \fn void wasm_extern_vec_new(wasm_extern_vec_t *out, size_t, wasm_extern_t *const[]);1791* \brief Creates a vector with the provided contents.1792*1793* See #wasm_byte_vec_new for more information.1794*1795* \fn void wasm_extern_vec_copy(wasm_extern_vec_t *out, const wasm_extern_vec_t *)1796* \brief Copies one vector to another1797*1798* See #wasm_byte_vec_copy for more information.1799*1800* \fn void wasm_extern_vec_delete(wasm_extern_vec_t *out)1801* \brief Deallocates import for a vector.1802*1803* See #wasm_byte_vec_delete for more information.1804*1805* \fn wasm_extern_t *wasm_extern_copy(const wasm_extern_t *)1806* \brief Copies a #wasm_extern_t to a new one.1807*1808* The caller is responsible for deleting the returned #wasm_extern_t.1809*1810* \fn void wasm_extern_same(const wasm_extern_t *, const wasm_extern_t *)1811* \brief Unimplemented in Wasmtime, aborts the process if called.1812*1813* \fn void* wasm_extern_get_host_info(const wasm_extern_t *);1814* \brief Unimplemented in Wasmtime, always returns `NULL`.1815*1816* \fn void wasm_extern_set_host_info(wasm_extern_t *, void *);1817* \brief Unimplemented in Wasmtime, aborts the process if called.1818*1819* \fn void wasm_extern_set_host_info_with_finalizer(wasm_extern_t *, void *, void(*)(void*));1820* \brief Unimplemented in Wasmtime, aborts the process if called.1821*1822* \fn wasm_ref_t *wasm_extern_as_ref(wasm_extern_t *);1823* \brief Unimplemented in Wasmtime, aborts the process if called.1824*1825* \fn wasm_extern_t *wasm_ref_as_extern(wasm_ref_t *);1826* \brief Unimplemented in Wasmtime, aborts the process if called.1827*1828* \fn const wasm_ref_t *wasm_extern_as_ref_const(const wasm_extern_t *);1829* \brief Unimplemented in Wasmtime, aborts the process if called.1830*1831* \fn const wasm_extern_t *wasm_ref_as_extern_const(const wasm_ref_t *);1832* \brief Unimplemented in Wasmtime, aborts the process if called.1833*1834* \fn wasm_ref_as_extern_const(const wasm_ref_t *);1835* \brief Unimplemented in Wasmtime, aborts the process if called.1836*1837* \fn wasm_externkind_t *wasm_extern_kind(const wasm_extern_t *);1838* \brief Returns the kind of this extern, indicating what it will downcast as.1839*1840* \fn wasm_externtype_t *wasm_extern_type(const wasm_extern_t *);1841* \brief Returns the type of this extern.1842*1843* The caller is expected to deallocate the returned #wasm_externtype_t.1844*/18451846/**1847* \fn wasm_extern_t *wasm_func_as_extern(wasm_func_t *f);1848* \brief Converts a #wasm_func_t to #wasm_extern_t.1849*1850* The returned #wasm_extern_t is owned by the #wasm_func_t argument. Callers1851* should not delete the returned value, and it only lives as long as the1852* #wasm_func_t argument.1853*1854* \fn wasm_extern_t *wasm_global_as_extern(wasm_global_t *f);1855* \brief Converts a #wasm_global_t to #wasm_extern_t.1856*1857* The returned #wasm_extern_t is owned by the #wasm_global_t argument. Callers1858* should not delete the returned value, and it only lives as long as the1859* #wasm_global_t argument.1860*1861* \fn wasm_extern_t *wasm_memory_as_extern(wasm_memory_t *f);1862* \brief Converts a #wasm_memory_t to #wasm_extern_t.1863*1864* The returned #wasm_extern_t is owned by the #wasm_memory_t argument. Callers1865* should not delete the returned value, and it only lives as long as the1866* #wasm_memory_t argument.1867*1868* \fn wasm_extern_t *wasm_table_as_extern(wasm_table_t *f);1869* \brief Converts a #wasm_table_t to #wasm_extern_t.1870*1871* The returned #wasm_extern_t is owned by the #wasm_table_t argument. Callers1872* should not delete the returned value, and it only lives as long as the1873* #wasm_table_t argument.1874*1875* \fn const wasm_extern_t *wasm_func_as_extern_const(const wasm_func_t *f);1876* \brief Converts a #wasm_func_t to #wasm_extern_t.1877*1878* The returned #wasm_extern_t is owned by the #wasm_func_t argument. Callers1879* should not delete the returned value, and it only lives as long as the1880* #wasm_func_t argument.1881*1882* \fn const wasm_extern_t *wasm_global_as_extern_const(const wasm_global_t *f);1883* \brief Converts a #wasm_global_t to #wasm_extern_t.1884*1885* The returned #wasm_extern_t is owned by the #wasm_global_t argument. Callers1886* should not delete the returned value, and it only lives as long as the1887* #wasm_global_t argument.1888*1889* \fn const wasm_extern_t *wasm_memory_as_extern_const(const wasm_memory_t *f);1890* \brief Converts a #wasm_memory_t to #wasm_extern_t.1891*1892* The returned #wasm_extern_t is owned by the #wasm_memory_t argument. Callers1893* should not delete the returned value, and it only lives as long as the1894* #wasm_memory_t argument.1895*1896* \fn const wasm_extern_t *wasm_table_as_extern_const(const wasm_table_t *f);1897* \brief Converts a #wasm_table_t to #wasm_extern_t.1898*1899* The returned #wasm_extern_t is owned by the #wasm_table_t argument. Callers1900* should not delete the returned value, and it only lives as long as the1901* #wasm_table_t argument.1902*1903* \fn wasm_func_t *wasm_extern_as_func(wasm_extern_t *);1904* \brief Converts a #wasm_extern_t to #wasm_func_t.1905*1906* The returned #wasm_func_t is owned by the #wasm_extern_t argument. Callers1907* should not delete the returned value, and it only lives as long as the1908* #wasm_extern_t argument.1909*1910* If the #wasm_extern_t argument isn't a #wasm_func_t then `NULL` is returned.1911*1912* \fn wasm_table_t *wasm_extern_as_table(wasm_extern_t *);1913* \brief Converts a #wasm_extern_t to #wasm_table_t.1914*1915* The returned #wasm_table_t is owned by the #wasm_extern_t argument. Callers1916* should not delete the returned value, and it only lives as long as the1917* #wasm_extern_t argument.1918*1919* If the #wasm_extern_t argument isn't a #wasm_table_t then `NULL` is returned.1920*1921* \fn wasm_memory_t *wasm_extern_as_memory(wasm_extern_t *);1922* \brief Converts a #wasm_extern_t to #wasm_memory_t.1923*1924* The returned #wasm_memory_t is owned by the #wasm_extern_t argument. Callers1925* should not delete the returned value, and it only lives as long as the1926* #wasm_extern_t argument.1927*1928* If the #wasm_extern_t argument isn't a #wasm_memory_t then `NULL` is returned.1929*1930* \fn wasm_global_t *wasm_extern_as_global(wasm_extern_t *);1931* \brief Converts a #wasm_extern_t to #wasm_global_t.1932*1933* The returned #wasm_global_t is owned by the #wasm_extern_t argument. Callers1934* should not delete the returned value, and it only lives as long as the1935* #wasm_extern_t argument.1936*1937* If the #wasm_extern_t argument isn't a #wasm_global_t then `NULL` is returned.1938*1939* \fn const wasm_func_t *wasm_extern_as_func_const(const wasm_extern_t *);1940* \brief Converts a #wasm_extern_t to #wasm_func_t.1941*1942* The returned #wasm_func_t is owned by the #wasm_extern_t argument. Callers1943* should not delete the returned value, and it only lives as long as the1944* #wasm_extern_t argument.1945*1946* If the #wasm_extern_t argument isn't a #wasm_func_t then `NULL` is returned.1947*1948* \fn const wasm_table_t *wasm_extern_as_table_const(const wasm_extern_t *);1949* \brief Converts a #wasm_extern_t to #wasm_table_t.1950*1951* The returned #wasm_table_t is owned by the #wasm_extern_t argument. Callers1952* should not delete the returned value, and it only lives as long as the1953* #wasm_extern_t argument.1954*1955* If the #wasm_extern_t argument isn't a #wasm_table_t then `NULL` is returned.1956*1957* \fn const wasm_memory_t *wasm_extern_as_memory_const(const wasm_extern_t *);1958* \brief Converts a #wasm_extern_t to #wasm_memory_t.1959*1960* The returned #wasm_memory_t is owned by the #wasm_extern_t argument. Callers1961* should not delete the returned value, and it only lives as long as the1962* #wasm_extern_t argument.1963*1964* If the #wasm_extern_t argument isn't a #wasm_memory_t then `NULL` is returned.1965*1966* \fn const wasm_global_t *wasm_extern_as_global_const(const wasm_extern_t *);1967* \brief Converts a #wasm_extern_t to #wasm_global_t.1968*1969* The returned #wasm_global_t is owned by the #wasm_extern_t argument. Callers1970* should not delete the returned value, and it only lives as long as the1971* #wasm_extern_t argument.1972*1973* If the #wasm_extern_t argument isn't a #wasm_global_t then `NULL` is returned.1974*/19751976/**1977* \struct wasm_instance_t1978* \brief Opaque struct representing a wasm instance.1979*1980* \typedef wasm_instance_t1981* \brief Convenience alias for #wasm_instance_t1982*1983* \fn void wasm_instance_delete(wasm_instance_t *v);1984* \brief Deletes a instance.1985*1986* \fn wasm_instance_t *wasm_instance_copy(const wasm_instance_t *)1987* \brief Copies a #wasm_instance_t to a new one.1988*1989* The caller is responsible for deleting the returned #wasm_instance_t.1990*1991* \fn void wasm_instance_same(const wasm_instance_t *, const wasm_instance_t *)1992* \brief Unimplemented in Wasmtime, aborts the process if called.1993*1994* \fn void* wasm_instance_get_host_info(const wasm_instance_t *);1995* \brief Unimplemented in Wasmtime, always returns `NULL`.1996*1997* \fn void wasm_instance_set_host_info(wasm_instance_t *, void *);1998* \brief Unimplemented in Wasmtime, aborts the process if called.1999*2000* \fn void wasm_instance_set_host_info_with_finalizer(wasm_instance_t *, void *, void(*)(void*));2001* \brief Unimplemented in Wasmtime, aborts the process if called.2002*2003* \fn wasm_ref_t *wasm_instance_as_ref(wasm_instance_t *);2004* \brief Unimplemented in Wasmtime, aborts the process if called.2005*2006* \fn wasm_instance_t *wasm_ref_as_instance(wasm_ref_t *);2007* \brief Unimplemented in Wasmtime, aborts the process if called.2008*2009* \fn const wasm_ref_t *wasm_instance_as_ref_const(const wasm_instance_t *);2010* \brief Unimplemented in Wasmtime, aborts the process if called.2011*2012* \fn const wasm_instance_t *wasm_ref_as_instance_const(const wasm_ref_t *);2013* \brief Unimplemented in Wasmtime, aborts the process if called.2014*2015* \fn wasm_ref_as_instance_const(const wasm_ref_t *);2016* \brief Unimplemented in Wasmtime, aborts the process if called.2017*2018* \fn wasm_instance_t *wasm_instance_new(wasm_store_t *, const wasm_module_t *, const wasm_extern_vec_t *, wasm_trap_t **);2019* \brief Instantiates a module with the provided imports.2020*2021* This function will instantiate the provided #wasm_module_t into the provided2022* #wasm_store_t. The `imports` specified are used to satisfy the imports of the2023* #wasm_module_t.2024*2025* This function must provide exactly the same number of imports as returned by2026* #wasm_module_imports or this results in undefined behavior.2027*2028* Imports provided are expected to be 1:1 matches against the list returned by2029* #wasm_module_imports.2030*2031* Instantiation includes invoking the `start` function of a wasm module. If2032* that function traps then a trap is returned through the #wasm_trap_t type.2033*2034* This function does not take ownership of any of its arguments, and the2035* returned #wasm_instance_t and #wasm_trap_t are owned by the caller.2036*2037* \fn void wasm_instance_exports(const wasm_instance_t *, wasm_extern_vec_t *out);2038* \brief Returns the exports of an instance.2039*2040* This function returns a list of #wasm_extern_t values, which will be owned by2041* the caller, which are exported from the instance. The `out` list will have2042* the same length as #wasm_module_exports called on the original module. Each2043* element is 1:1 matched with the elements in the list of #wasm_module_exports.2044*/20452046/**2047* \def WASM_EMPTY_VEC2048* \brief Used to initialize an empty vector type.2049*2050* \def WASM_ARRAY_VEC2051* \brief Used to initialize a vector type from a C array.2052*2053* \def WASM_I32_VAL2054* \brief Used to initialize a 32-bit integer wasm_val_t value.2055*2056* \def WASM_I64_VAL2057* \brief Used to initialize a 64-bit integer wasm_val_t value.2058*2059* \def WASM_F32_VAL2060* \brief Used to initialize a 32-bit floating point wasm_val_t value.2061*2062* \def WASM_F64_VAL2063* \brief Used to initialize a 64-bit floating point wasm_val_t value.2064*2065* \def WASM_REF_VAL2066* \brief Used to initialize an externref wasm_val_t value.2067*2068* \def WASM_INIT_VAL2069* \brief Used to initialize a null externref wasm_val_t value.2070*/207120722073