1 /* clang-format off */ 2 3 /** 4 * \file wasm.h 5 * 6 * Upstream Embedding API for WebAssembly. 7 * 8 * This API is defined by the upstream wasm-c-api proposal at 9 * https://github.com/WebAssembly/wasm-c-api. That proposal is in flux but 10 * Wasmtime intends to be active in its development. 11 * 12 * The documentation for this header file is currently defined in the Wasmtime 13 * project, not in the upstream header file. Some behavior here may be 14 * Wasmtime-specific and may not be portable to other engines implementing the 15 * same C API. Also note that not all functionality from the upstream C API is 16 * implemented in Wasmtime. We strive to provide all symbols as to not generate 17 * link errors but some functions are unimplemented and will abort the process 18 * if called. 19 * 20 * ### Memory Management 21 * 22 * Memory management in the wasm C API is intended to be relatively simple. Each 23 * individual object is reference counted unless otherwise noted. You can delete 24 * any object at any time after you no longer need it. Deletion of an object 25 * does not imply that the memory will be deallocated at that time. If another 26 * object still internally references the original object then the memory will 27 * still be alive. 28 * 29 * For example you can delete a #wasm_engine_t after you create a #wasm_store_t 30 * with #wasm_store_new. The engine, however, is still referenced by the 31 * #wasm_store_t so it will not be deallocated. In essence by calling 32 * #wasm_engine_delete you're release your own strong reference on the 33 * #wasm_engine_t, but that's it. 34 * 35 * Additionally APIs like #wasm_memory_copy do not actually copy the underlying 36 * data. Instead they only increment the reference count and return a new 37 * object. You'll need to still call #wasm_memory_delete (or the corresponding 38 * `*_delete` function) for each copy of an object you acquire. 39 * 40 * ### Vectors 41 * 42 * This API provides a number of `wasm_*_vec_t` type definitions and functions 43 * to work with them. Each vector is defined by a pointer and a length. 44 * "Ownership" of a vector refers to the data pointer, not the memory holding 45 * the data pointer and the length. It is safe, for example to create a 46 * #wasm_name_t on the stack and pass it to #wasm_importtype_new. The memory 47 * pointed to by #wasm_name_t must be properly initialized, however, and cannot 48 * reside on the stack. 49 */ 50 51 /** 52 * \typedef byte_t 53 * \brief A type definition for a number that occupies a single byte of data. 54 * 55 * \typedef wasm_byte_t 56 * \brief A type definition for a number that occupies a single byte of data. 57 * 58 * \typedef float32_t 59 * \brief A type definition for a 32-bit float. 60 * 61 * \typedef float64_t 62 * \brief A type definition for a 64-bit float. 63 * 64 * \typedef wasm_name_t 65 * \brief Convenience for hinting that an argument only accepts utf-8 input. 66 */ 67 68 /** 69 * \typedef wasm_config_t 70 * \brief Convenience alias for #wasm_config_t 71 * 72 * \struct wasm_config_t 73 * \brief Global engine configuration 74 * 75 * This structure represents global configuration used when constructing a 76 * #wasm_engine_t. There are now functions to modify this from wasm.h but the 77 * wasmtime/config.h header provides a number of Wasmtime-specific functions to 78 * tweak configuration options. 79 * 80 * This object is created with #wasm_config_new. 81 * 82 * Configuration is safe to share between threads. Typically you'll create a 83 * config object and immediately pass it into #wasm_engine_new_with_config, 84 * however. 85 * 86 * For more information about configuration see the Rust documentation as well 87 * at 88 * https://bytecodealliance.github.io/wasmtime/api/wasmtime/struct.Config.html. 89 * 90 * \fn wasm_config_t *wasm_config_new(void); 91 * \brief Creates a new empty configuration object. 92 * 93 * The object returned is owned by the caller and will need to be deleted with 94 * #wasm_config_delete. May return `NULL` if a configuration object could not be 95 * allocated. 96 * 97 * \fn void wasm_config_delete(wasm_config_t*); 98 * \brief Deletes a configuration object. 99 */ 100 101 /** 102 * \typedef wasm_engine_t 103 * \brief Convenience alias for #wasm_engine_t 104 * 105 * \struct wasm_engine_t 106 * \brief Compilation environment and configuration. 107 * 108 * An engine is typically global in a program and contains all the configuration 109 * necessary for compiling wasm code. From an engine you'll typically create a 110 * #wasmtime_store_t. Engines are created with #wasm_engine_new or 111 * #wasm_engine_new_with_config. 112 * 113 * An engine is safe to share between threads. Multiple stores can be created 114 * within the same engine with each store living on a separate thread. Typically 115 * you'll create one #wasm_engine_t for the lifetime of your program. 116 * 117 * Engines are reference counted internally so #wasm_engine_delete can be called 118 * at any time after a #wasmtime_store_t has been created from one. 119 * 120 * \fn wasm_engine_t *wasm_engine_new(void); 121 * \brief Creates a new engine with the default configuration. 122 * 123 * The object returned is owned by the caller and will need to be deleted with 124 * #wasm_engine_delete. This may return `NULL` if the engine could not be 125 * allocated. 126 * 127 * \fn wasm_engine_t *wasm_engine_new_with_config(wasm_config_t *); 128 * \brief Creates a new engine with the specified configuration. 129 * 130 * This function will take ownership of the configuration specified regardless 131 * of the outcome of this function. You do not need to call #wasm_config_delete 132 * on the argument. The object returned is owned by the caller and will need to 133 * be deleted with #wasm_engine_delete. This may return `NULL` if the engine 134 * could not be allocated. 135 * 136 * \fn void wasm_engine_delete(wasm_engine_t*); 137 * \brief Deletes an engine. 138 */ 139 140 /** 141 * \typedef wasm_store_t 142 * \brief Convenience alias for #wasm_store_t 143 * 144 * \struct wasm_store_t 145 * \brief A collection of instances and wasm global items. 146 * 147 * A #wasm_store_t corresponds to the concept of an [embedding 148 * store](https://webassembly.github.io/spec/core/exec/runtime.html#store) 149 * 150 * \fn wasm_store_t *wasm_store_new(wasm_engine_t *); 151 * \brief Creates a new store within the specified engine. 152 * 153 * The object returned is owned by the caller and will need to be deleted with 154 * #wasm_store_delete. This may return `NULL` if the store could not be 155 * allocated. 156 * 157 * \fn void wasm_store_delete(wasm_store_t *); 158 * \brief Deletes the specified store. 159 */ 160 161 /** 162 * \struct wasm_byte_vec_t 163 * \brief A list of bytes 164 * 165 * Used to pass data in or pass data out of various functions. The meaning and 166 * ownership of the bytes is defined by each API that operates on this 167 * datatype. 168 * 169 * \var wasm_byte_vec_t::size 170 * \brief Length of this vector. 171 * 172 * \var wasm_byte_vec_t::data 173 * \brief Pointer to the base of this vector 174 * 175 * \typedef wasm_byte_vec_t 176 * \brief Convenience alias for #wasm_byte_vec_t 177 * 178 * \typedef wasm_message_t 179 * \brief Alias of #wasm_byte_vec_t which always has a trailing 0-byte. 180 * 181 * \fn wasm_name 182 * \brief Unused by Wasmtime 183 * 184 * \fn wasm_name_new 185 * \brief Convenience alias 186 * 187 * \fn wasm_name_new_empty 188 * \brief Convenience alias 189 * 190 * \fn wasm_name_new_uninitialized 191 * \brief Convenience alias 192 * 193 * \fn wasm_name_new_from_string 194 * \brief Create a new name from a C string. 195 * 196 * \fn wasm_name_new_from_string_nt 197 * \brief Create a new name from a C string with null terminator. 198 * 199 * \fn wasm_name_copy 200 * \brief Convenience alias 201 * 202 * \fn wasm_name_delete 203 * \brief Convenience alias 204 * 205 * \fn void wasm_byte_vec_new_empty(wasm_byte_vec_t *out); 206 * \brief Initializes an empty byte vector. 207 * 208 * \fn void wasm_byte_vec_new_uninitialized(wasm_byte_vec_t *out, size_t); 209 * \brief Initializes an byte vector with the specified capacity. 210 * 211 * This function will initialize the provided vector with capacity to hold the 212 * specified number of bytes. The `out` parameter must previously not already be 213 * initialized and after this function is called you are then responsible for 214 * ensuring #wasm_byte_vec_delete is called. 215 * 216 * \fn void wasm_byte_vec_new(wasm_byte_vec_t *out, size_t, wasm_byte_t const[]); 217 * \brief Copies the specified data into a new byte vector. 218 * 219 * This function will copy the provided data into this byte vector. The byte 220 * vector should not be previously initialized and the caller is responsible for 221 * calling #wasm_byte_vec_delete after this function returns. 222 * 223 * Note that memory of the initialization vector provided to this function 224 * must be managed externally. This function will copy the contents to the 225 * output vector, but it's up to the caller to properly deallocate the memory. 226 * 227 * \fn void wasm_byte_vec_copy(wasm_byte_vec_t *out, const wasm_byte_vec_t *); 228 * \brief Copies one vector into a new vector. 229 * 230 * Copies the second argument's data into the first argument. The `out` vector 231 * should not be previously initialized and after this function returns you're 232 * responsible for calling #wasm_byte_vec_delete. 233 * 234 * \fn void wasm_byte_vec_delete(wasm_byte_vec_t *); 235 * \brief Deletes a byte vector. 236 * 237 * This function will deallocate the data referenced by the argument provided. 238 * This does not deallocate the memory holding the #wasm_byte_vec_t itself, it's 239 * expected that memory is owned by the caller. 240 */ 241 242 /** 243 * \struct wasm_valtype_t 244 * \brief An object representing the type of a value. 245 * 246 * \typedef wasm_valtype_t 247 * \brief Convenience alias for #wasm_valtype_t 248 * 249 * \struct wasm_valtype_vec_t 250 * \brief A list of #wasm_valtype_t values. 251 * 252 * \var wasm_valtype_vec_t::size 253 * \brief Length of this vector. 254 * 255 * \var wasm_valtype_vec_t::data 256 * \brief Pointer to the base of this vector 257 * 258 * \typedef wasm_valtype_vec_t 259 * \brief Convenience alias for #wasm_valtype_vec_t 260 * 261 * \fn void wasm_valtype_delete(wasm_valtype_t *); 262 * \brief Deletes a type. 263 * 264 * \fn void wasm_valtype_vec_new_empty(wasm_valtype_vec_t *out); 265 * \brief Creates an empty vector. 266 * 267 * See #wasm_byte_vec_new_empty for more information. 268 * 269 * \fn void wasm_valtype_vec_new_uninitialized(wasm_valtype_vec_t *out, size_t); 270 * \brief Creates a vector with the given capacity. 271 * 272 * See #wasm_byte_vec_new_uninitialized for more information. 273 * 274 * \fn void wasm_valtype_vec_new(wasm_valtype_vec_t *out, size_t, wasm_valtype_t *const[]); 275 * \brief Creates a vector with the provided contents. 276 * 277 * See #wasm_byte_vec_new for more information. 278 * 279 * \fn void wasm_valtype_vec_copy(wasm_valtype_vec_t *out, const wasm_valtype_vec_t *) 280 * \brief Copies one vector to another 281 * 282 * See #wasm_byte_vec_copy for more information. 283 * 284 * \fn void wasm_valtype_vec_delete(wasm_valtype_vec_t *out) 285 * \brief Deallocates memory for a vector. 286 * 287 * See #wasm_byte_vec_delete for more information. 288 * 289 * \fn wasm_valtype_t* wasm_valtype_copy(const wasm_valtype_t *) 290 * \brief Creates a new value which matches the provided one. 291 * 292 * The caller is responsible for deleting the returned value. 293 * 294 * \fn wasm_valtype_t* wasm_valtype_new(wasm_valkind_t); 295 * \brief Creates a new value type from the specified kind. 296 * 297 * The caller is responsible for deleting the returned value. 298 * 299 * \fn wasm_valkind_t wasm_valtype_kind(const wasm_valtype_t *); 300 * \brief Returns the associated kind for this value type. 301 */ 302 303 /** 304 * \typedef wasm_valkind_t 305 * \brief Different kinds of types supported in wasm. 306 */ 307 308 /** 309 * \struct wasm_functype_t 310 * \brief An opaque object representing the type of a function. 311 * 312 * \typedef wasm_functype_t 313 * \brief Convenience alias for #wasm_functype_t 314 * 315 * \struct wasm_functype_vec_t 316 * \brief A list of #wasm_functype_t values. 317 * 318 * \var wasm_functype_vec_t::size 319 * \brief Length of this vector. 320 * 321 * \var wasm_functype_vec_t::data 322 * \brief Pointer to the base of this vector 323 * 324 * \typedef wasm_functype_vec_t 325 * \brief Convenience alias for #wasm_functype_vec_t 326 * 327 * \fn void wasm_functype_delete(wasm_functype_t *); 328 * \brief Deletes a type. 329 * 330 * \fn void wasm_functype_vec_new_empty(wasm_functype_vec_t *out); 331 * \brief Creates an empty vector. 332 * 333 * See #wasm_byte_vec_new_empty for more information. 334 * 335 * \fn void wasm_functype_vec_new_uninitialized(wasm_functype_vec_t *out, size_t); 336 * \brief Creates a vector with the given capacity. 337 * 338 * See #wasm_byte_vec_new_uninitialized for more information. 339 * 340 * \fn void wasm_functype_vec_new(wasm_functype_vec_t *out, size_t, wasm_functype_t *const[]); 341 * \brief Creates a vector with the provided contents. 342 * 343 * See #wasm_byte_vec_new for more information. 344 * 345 * \fn void wasm_functype_vec_copy(wasm_functype_vec_t *out, const wasm_functype_vec_t *) 346 * \brief Copies one vector to another 347 * 348 * See #wasm_byte_vec_copy for more information. 349 * 350 * \fn void wasm_functype_vec_delete(wasm_functype_vec_t *out) 351 * \brief Deallocates memory for a vector. 352 * 353 * See #wasm_byte_vec_delete for more information. 354 * 355 * \fn wasm_functype_t* wasm_functype_copy(const wasm_functype_t *) 356 * \brief Creates a new value which matches the provided one. 357 * 358 * The caller is responsible for deleting the returned value. 359 * 360 * \fn wasm_functype_t* wasm_functype_new(wasm_valtype_vec_t *params, wasm_valtype_vec_t *results); 361 * \brief Creates a new function type with the provided parameter and result 362 * types. 363 * 364 * This function takes ownership of the `params` and `results` arguments. 365 * 366 * The caller is responsible for deleting the returned value. 367 * 368 * \fn const wasm_valtype_vec_t* wasm_functype_params(const wasm_functype_t *); 369 * \brief Returns the list of parameters of this function type. 370 * 371 * The returned memory is owned by the #wasm_functype_t argument, the caller 372 * should not deallocate it. 373 * 374 * \fn const wasm_valtype_vec_t* wasm_functype_results(const wasm_functype_t *); 375 * \brief Returns the list of results of this function type. 376 * 377 * The returned memory is owned by the #wasm_functype_t argument, the caller 378 * should not deallocate it. 379 */ 380 381 /** 382 * \struct wasm_globaltype_t 383 * \brief An opaque object representing the type of a global. 384 * 385 * \typedef wasm_globaltype_t 386 * \brief Convenience alias for #wasm_globaltype_t 387 * 388 * \struct wasm_globaltype_vec_t 389 * \brief A list of #wasm_globaltype_t values. 390 * 391 * \var wasm_globaltype_vec_t::size 392 * \brief Length of this vector. 393 * 394 * \var wasm_globaltype_vec_t::data 395 * \brief Pointer to the base of this vector 396 * 397 * \typedef wasm_globaltype_vec_t 398 * \brief Convenience alias for #wasm_globaltype_vec_t 399 * 400 * \fn void wasm_globaltype_delete(wasm_globaltype_t *); 401 * \brief Deletes a type. 402 * 403 * \fn void wasm_globaltype_vec_new_empty(wasm_globaltype_vec_t *out); 404 * \brief Creates an empty vector. 405 * 406 * See #wasm_byte_vec_new_empty for more information. 407 * 408 * \fn void wasm_globaltype_vec_new_uninitialized(wasm_globaltype_vec_t *out, size_t); 409 * \brief Creates a vector with the given capacity. 410 * 411 * See #wasm_byte_vec_new_uninitialized for more information. 412 * 413 * \fn void wasm_globaltype_vec_new(wasm_globaltype_vec_t *out, size_t, wasm_globaltype_t *const[]); 414 * \brief Creates a vector with the provided contents. 415 * 416 * See #wasm_byte_vec_new for more information. 417 * 418 * \fn void wasm_globaltype_vec_copy(wasm_globaltype_vec_t *out, const wasm_globaltype_vec_t *) 419 * \brief Copies one vector to another 420 * 421 * See #wasm_byte_vec_copy for more information. 422 * 423 * \fn void wasm_globaltype_vec_delete(wasm_globaltype_vec_t *out) 424 * \brief Deallocates memory for a vector. 425 * 426 * See #wasm_byte_vec_delete for more information. 427 * 428 * \fn wasm_globaltype_t* wasm_globaltype_copy(const wasm_globaltype_t *) 429 * \brief Creates a new value which matches the provided one. 430 * 431 * The caller is responsible for deleting the returned value. 432 * 433 * \fn wasm_globaltype_t* wasm_globaltype_new(wasm_valtype_t *, wasm_mutability_t) 434 * \brief Creates a new global type. 435 * 436 * This function takes ownership of the #wasm_valtype_t argument. 437 * 438 * The caller is responsible for deleting the returned value. 439 * 440 * \fn const wasm_valtype_t* wasm_globaltype_content(const wasm_globaltype_t *); 441 * \brief Returns the type of value contained in a global. 442 * 443 * The returned memory is owned by the provided #wasm_globaltype_t, the caller 444 * should not deallocate it. 445 * 446 * \fn wasm_mutability_t wasm_globaltype_mutability(const wasm_globaltype_t *); 447 * \brief Returns whether or not a global is mutable. 448 */ 449 450 /** 451 * \typedef wasm_mutability_t 452 * \brief Boolean flag for whether a global is mutable or not. 453 */ 454 455 /** 456 * \struct wasm_tabletype_t 457 * \brief An opaque object representing the type of a table. 458 * 459 * \typedef wasm_tabletype_t 460 * \brief Convenience alias for #wasm_tabletype_t 461 * 462 * \struct wasm_tabletype_vec_t 463 * \brief A list of #wasm_tabletype_t values. 464 * 465 * \var wasm_tabletype_vec_t::size 466 * \brief Length of this vector. 467 * 468 * \var wasm_tabletype_vec_t::data 469 * \brief Pointer to the base of this vector 470 * 471 * \typedef wasm_tabletype_vec_t 472 * \brief Convenience alias for #wasm_tabletype_vec_t 473 * 474 * \fn void wasm_tabletype_delete(wasm_tabletype_t *); 475 * \brief Deletes a type. 476 * 477 * \fn void wasm_tabletype_vec_new_empty(wasm_tabletype_vec_t *out); 478 * \brief Creates an empty vector. 479 * 480 * See #wasm_byte_vec_new_empty for more information. 481 * 482 * \fn void wasm_tabletype_vec_new_uninitialized(wasm_tabletype_vec_t *out, size_t); 483 * \brief Creates a vector with the given capacity. 484 * 485 * See #wasm_byte_vec_new_uninitialized for more information. 486 * 487 * \fn void wasm_tabletype_vec_new(wasm_tabletype_vec_t *out, size_t, wasm_tabletype_t *const[]); 488 * \brief Creates a vector with the provided contents. 489 * 490 * See #wasm_byte_vec_new for more information. 491 * 492 * \fn void wasm_tabletype_vec_copy(wasm_tabletype_vec_t *out, const wasm_tabletype_vec_t *) 493 * \brief Copies one vector to another 494 * 495 * See #wasm_byte_vec_copy for more information. 496 * 497 * \fn void wasm_tabletype_vec_delete(wasm_tabletype_vec_t *out) 498 * \brief Deallocates memory for a vector. 499 * 500 * See #wasm_byte_vec_delete for more information. 501 * 502 * \fn wasm_tabletype_t* wasm_tabletype_copy(const wasm_tabletype_t *) 503 * \brief Creates a new value which matches the provided one. 504 * 505 * The caller is responsible for deleting the returned value. 506 * 507 * \fn wasm_tabletype_t* wasm_tabletype_new(wasm_valtype_t *, const wasm_limits_t *)h 508 * \brief Creates a new table type. 509 * 510 * This function takes ownership of the #wasm_valtype_t argument, but does not 511 * take ownership of the #wasm_limits_t. 512 * 513 * The caller is responsible for deallocating the returned type. 514 * 515 * \fn const wasm_valtype_t* wasm_tabletype_element(const wasm_tabletype_t *); 516 * \brief Returns the element type of this table. 517 * 518 * The returned #wasm_valtype_t is owned by the #wasm_tabletype_t parameter, the 519 * caller should not deallocate it. 520 * 521 * \fn const wasm_limits_t* wasm_tabletype_limits(const wasm_tabletype_t *); 522 * \brief Returns the limits of this table. 523 * 524 * The returned #wasm_limits_t is owned by the #wasm_tabletype_t parameter, the 525 * caller should not deallocate it. 526 */ 527 528 /** 529 * \struct wasm_limits_t 530 * \brief Limits for tables/memories in wasm modules 531 * \var wasm_limits_t::min 532 * The minimum value required. 533 * \var wasm_limits_t::max 534 * The maximum value required, or `wasm_limits_max_default` if no maximum is 535 * specified. 536 * 537 * \typedef wasm_limits_t 538 * \brief A convenience typedef to #wasm_limits_t 539 */ 540 541 /** 542 * \struct wasm_memorytype_t 543 * \brief An opaque object representing the type of a memory. 544 * 545 * \typedef wasm_memorytype_t 546 * \brief Convenience alias for #wasm_memorytype_t 547 * 548 * \struct wasm_memorytype_vec_t 549 * \brief A list of #wasm_memorytype_t values. 550 * 551 * \var wasm_memorytype_vec_t::size 552 * \brief Length of this vector. 553 * 554 * \var wasm_memorytype_vec_t::data 555 * \brief Pointer to the base of this vector 556 * 557 * \typedef wasm_memorytype_vec_t 558 * \brief Convenience alias for #wasm_memorytype_vec_t 559 * 560 * \fn void wasm_memorytype_delete(wasm_memorytype_t *); 561 * \brief Deletes a type. 562 * 563 * \fn void wasm_memorytype_vec_new_empty(wasm_memorytype_vec_t *out); 564 * \brief Creates an empty vector. 565 * 566 * See #wasm_byte_vec_new_empty for more information. 567 * 568 * \fn void wasm_memorytype_vec_new_uninitialized(wasm_memorytype_vec_t *out, size_t); 569 * \brief Creates a vector with the given capacity. 570 * 571 * See #wasm_byte_vec_new_uninitialized for more information. 572 * 573 * \fn void wasm_memorytype_vec_new(wasm_memorytype_vec_t *out, size_t, wasm_memorytype_t *const[]); 574 * \brief Creates a vector with the provided contents. 575 * 576 * See #wasm_byte_vec_new for more information. 577 * 578 * \fn void wasm_memorytype_vec_copy(wasm_memorytype_vec_t *out, const wasm_memorytype_vec_t *) 579 * \brief Copies one vector to another 580 * 581 * See #wasm_byte_vec_copy for more information. 582 * 583 * \fn void wasm_memorytype_vec_delete(wasm_memorytype_vec_t *out) 584 * \brief Deallocates memory for a vector. 585 * 586 * See #wasm_byte_vec_delete for more information. 587 * 588 * \fn wasm_memorytype_t* wasm_memorytype_copy(const wasm_memorytype_t *) 589 * \brief Creates a new value which matches the provided one. 590 * 591 * The caller is responsible for deleting the returned value. 592 * 593 * \fn wasm_memorytype_t* wasm_memorytype_new(const wasm_limits_t *)h 594 * \brief Creates a new memory type. 595 * 596 * This function takes ownership of the #wasm_valtype_t argument, but does not 597 * take ownership of the #wasm_limits_t. 598 * 599 * The caller is responsible for deallocating the returned type. 600 * 601 * For compatibility with memory64 it's recommended to use 602 * #wasmtime_memorytype_new instead. 603 * 604 * \fn const wasm_limits_t* wasm_memorytype_limits(const wasm_memorytype_t *); 605 * \brief Returns the limits of this memory. 606 * 607 * The returned #wasm_limits_t is owned by the #wasm_memorytype_t parameter, the 608 * caller should not deallocate it. 609 * 610 * For compatibility with memory64 it's recommended to use 611 * #wasmtime_memorytype_maximum or #wasmtime_memorytype_minimum instead. 612 */ 613 614 /** 615 * \struct wasm_tagtype_t 616 * \brief An opaque object representing the type of a tag. 617 * 618 * \typedef wasm_tagtype_t 619 * \brief Convenience alias for #wasm_tagtype_t 620 * 621 * \struct wasm_tagtype_vec_t 622 * \brief A list of #wasm_tagtype_t values. 623 * 624 * \var wasm_tagtype_vec_t::size 625 * \brief Length of this vector. 626 * 627 * \var wasm_tagtype_vec_t::data 628 * \brief Pointer to the base of this vector 629 * 630 * \typedef wasm_tagtype_vec_t 631 * \brief Convenience alias for #wasm_tagtype_vec_t 632 * 633 * \fn void wasm_tagtype_delete(wasm_tagtype_t *); 634 * \brief Deletes a type. 635 * 636 * \fn void wasm_tagtype_vec_new_empty(wasm_tagtype_vec_t *out); 637 * \brief Creates an empty vector. 638 * 639 * See #wasm_byte_vec_new_empty for more information. 640 * 641 * \fn void wasm_tagtype_vec_new_uninitialized(wasm_tagtype_vec_t *out, size_t); 642 * \brief Creates a vector with the given capacity. 643 * 644 * See #wasm_byte_vec_new_uninitialized for more information. 645 * 646 * \fn void wasm_tagtype_vec_new(wasm_tagtype_vec_t *out, size_t, wasm_tagtype_t *const[]); 647 * \brief Creates a vector with the provided contents. 648 * 649 * See #wasm_byte_vec_new for more information. 650 * 651 * \fn void wasm_tagtype_vec_copy(wasm_tagtype_vec_t *out, const wasm_tagtype_vec_t *) 652 * \brief Copies one vector to another 653 * 654 * See #wasm_byte_vec_copy for more information. 655 * 656 * \fn void wasm_tagtype_vec_delete(wasm_tagtype_vec_t *out) 657 * \brief Deallocates memory for a vector. 658 * 659 * See #wasm_byte_vec_delete for more information. 660 * 661 * \fn wasm_tagtype_t* wasm_tagtype_copy(const wasm_tagtype_t *) 662 * \brief Creates a new value which matches the provided one. 663 * 664 * The caller is responsible for deleting the returned value. 665 * 666 * \fn wasm_tagtype_t* wasm_tagtype_new(wasm_functype_t *) 667 * \brief Creates a new tag type. 668 * 669 * This function takes ownership of the #wasm_functype_t argument. 670 * 671 * The caller is responsible for deallocating the returned type. 672 * 673 * \fn const wasm_functype_t* wasm_tagtype_functype(const wasm_tagtype_t *); 674 * \brief Returns the function type of this tag type. 675 * 676 * The returned #wasm_functype_t is owned by the #wasm_tagtype_t parameter, the 677 * caller should not deallocate it. 678 */ 679 680 /** 681 * \struct wasm_externtype_t 682 * \brief An opaque object representing the type of a external value. Can be 683 * seen as a superclass of #wasm_functype_t, #wasm_tabletype_t, 684 * #wasm_globaltype_t, #wasm_memorytype_t, and #wasm_tagtype_t. 685 * 686 * \typedef wasm_externtype_t 687 * \brief Convenience alias for #wasm_externtype_t 688 * 689 * \struct wasm_externtype_vec_t 690 * \brief A list of #wasm_externtype_t values. 691 * 692 * \var wasm_externtype_vec_t::size 693 * \brief Length of this vector. 694 * 695 * \var wasm_externtype_vec_t::data 696 * \brief Pointer to the base of this vector 697 * 698 * \typedef wasm_externtype_vec_t 699 * \brief Convenience alias for #wasm_externtype_vec_t 700 * 701 * \fn void wasm_externtype_delete(wasm_externtype_t *); 702 * \brief Deletes a type. 703 * 704 * \fn void wasm_externtype_vec_new_empty(wasm_externtype_vec_t *out); 705 * \brief Creates an empty vector. 706 * 707 * See #wasm_byte_vec_new_empty for more information. 708 * 709 * \fn void wasm_externtype_vec_new_uninitialized(wasm_externtype_vec_t *out, size_t); 710 * \brief Creates a vector with the given capacity. 711 * 712 * See #wasm_byte_vec_new_uninitialized for more information. 713 * 714 * \fn void wasm_externtype_vec_new(wasm_externtype_vec_t *out, size_t, wasm_externtype_t *const[]); 715 * \brief Creates a vector with the provided contents. 716 * 717 * See #wasm_byte_vec_new for more information. 718 * 719 * \fn void wasm_externtype_vec_copy(wasm_externtype_vec_t *out, const wasm_externtype_vec_t *) 720 * \brief Copies one vector to another 721 * 722 * See #wasm_byte_vec_copy for more information. 723 * 724 * \fn void wasm_externtype_vec_delete(wasm_externtype_vec_t *out) 725 * \brief Deallocates extern for a vector. 726 * 727 * See #wasm_byte_vec_delete for more information. 728 * 729 * \fn wasm_externtype_t* wasm_externtype_copy(const wasm_externtype_t *) 730 * \brief Creates a new value which matches the provided one. 731 * 732 * The caller is responsible for deleting the returned value. 733 * 734 * \fn wasm_externkind_t wasm_externtype_kind(const wasm_externtype_t *) 735 * \brief Returns the kind of external item this type represents. 736 */ 737 738 /** 739 * \typedef wasm_externkind_t 740 * \brief Classifier for #wasm_externtype_t 741 * 742 * This is returned from #wasm_extern_kind and #wasm_externtype_kind to 743 * determine what kind of type is wrapped. 744 * 745 * \def WASM_EXTERN_FUNC 746 * \brief Indicator that an extern is a function. 747 * 748 * \def WASM_EXTERN_GLOBAL 749 * \brief Indicator that an extern is a global. 750 * 751 * \def WASM_EXTERN_TABLE 752 * \brief Indicator that an extern is a table. 753 * 754 * \def WASM_EXTERN_MEMORY 755 * \brief Indicator that an extern is a memory. 756 * 757 * \def WASM_EXTERN_TAG 758 * \brief Indicator that an extern is a tag. 759 */ 760 761 /** 762 * \fn wasm_externtype_t* wasm_functype_as_externtype(wasm_functype_t *) 763 * \brief Converts a #wasm_functype_t to a #wasm_externtype_t 764 * 765 * The returned value is owned by the #wasm_functype_t argument and should not 766 * be deleted. 767 * 768 * \fn wasm_externtype_t* wasm_tabletype_as_externtype(wasm_tabletype_t *) 769 * \brief Converts a #wasm_tabletype_t to a #wasm_externtype_t 770 * 771 * The returned value is owned by the #wasm_tabletype_t argument and should not 772 * be deleted. 773 * 774 * \fn wasm_externtype_t* wasm_globaltype_as_externtype(wasm_globaltype_t *) 775 * \brief Converts a #wasm_globaltype_t to a #wasm_externtype_t 776 * 777 * The returned value is owned by the #wasm_globaltype_t argument and should not 778 * be deleted. 779 * 780 * \fn wasm_externtype_t* wasm_memorytype_as_externtype(wasm_memorytype_t *) 781 * \brief Converts a #wasm_memorytype_t to a #wasm_externtype_t 782 * 783 * The returned value is owned by the #wasm_memorytype_t argument and should not 784 * be deleted. 785 * 786 * \fn wasm_externtype_t* wasm_tagtype_as_externtype(wasm_tagtype_t *) 787 * \brief Converts a #wasm_tagtype_t to a #wasm_externtype_t 788 * 789 * The returned value is owned by the #wasm_tagtype_t argument and should not 790 * be deleted. 791 * 792 * \fn const wasm_externtype_t* wasm_functype_as_externtype_const(const wasm_functype_t *) 793 * \brief Converts a #wasm_functype_t to a #wasm_externtype_t 794 * 795 * The returned value is owned by the #wasm_functype_t argument and should not 796 * be deleted. 797 * 798 * \fn const wasm_externtype_t* wasm_tabletype_as_externtype_const(const wasm_tabletype_t *) 799 * \brief Converts a #wasm_tabletype_t to a #wasm_externtype_t 800 * 801 * The returned value is owned by the #wasm_tabletype_t argument and should not 802 * be deleted. 803 * 804 * \fn const wasm_externtype_t* wasm_globaltype_as_externtype_const(const wasm_globaltype_t *) 805 * \brief Converts a #wasm_globaltype_t to a #wasm_externtype_t 806 * 807 * The returned value is owned by the #wasm_globaltype_t argument and should not 808 * be deleted. 809 * 810 * \fn const wasm_externtype_t* wasm_memorytype_as_externtype_const(const wasm_memorytype_t *) 811 * \brief Converts a #wasm_memorytype_t to a #wasm_externtype_t 812 * 813 * The returned value is owned by the #wasm_memorytype_t argument and should not 814 * be deleted. 815 * 816 * \fn const wasm_externtype_t* wasm_tagtype_as_externtype_const(const wasm_tagtype_t *) 817 * \brief Converts a #wasm_tagtype_t to a #wasm_externtype_t 818 * 819 * The returned value is owned by the #wasm_tagtype_t argument and should not 820 * be deleted. 821 * 822 * \fn wasm_functype_t* wasm_externtype_as_functype(wasm_externtype_t *) 823 * \brief Attempts to convert a #wasm_externtype_t to a #wasm_functype_t 824 * 825 * The returned value is owned by the #wasm_functype_t argument and should not 826 * be deleted. Returns `NULL` if the provided argument is not a 827 * #wasm_functype_t. 828 * 829 * \fn wasm_tabletype_t* wasm_externtype_as_tabletype(wasm_externtype_t *) 830 * \brief Attempts to convert a #wasm_externtype_t to a #wasm_tabletype_t 831 * 832 * The returned value is owned by the #wasm_tabletype_t argument and should not 833 * be deleted. Returns `NULL` if the provided argument is not a 834 * #wasm_tabletype_t. 835 * 836 * \fn wasm_memorytype_t* wasm_externtype_as_memorytype(wasm_externtype_t *) 837 * \brief Attempts to convert a #wasm_externtype_t to a #wasm_memorytype_t 838 * 839 * The returned value is owned by the #wasm_memorytype_t argument and should not 840 * be deleted. Returns `NULL` if the provided argument is not a 841 * #wasm_memorytype_t. 842 * 843 * \fn wasm_tagtype_t* wasm_externtype_as_tagtype(wasm_externtype_t *) 844 * \brief Attempts to convert a #wasm_externtype_t to a #wasm_tagtype_t 845 * 846 * The returned value is owned by the #wasm_tagtype_t argument and should not 847 * be deleted. Returns `NULL` if the provided argument is not a 848 * #wasm_tagtype_t. 849 * 850 * \fn wasm_globaltype_t* wasm_externtype_as_globaltype(wasm_externtype_t *) 851 * \brief Attempts to convert a #wasm_externtype_t to a #wasm_globaltype_t 852 * 853 * The returned value is owned by the #wasm_globaltype_t argument and should not 854 * be deleted. Returns `NULL` if the provided argument is not a 855 * #wasm_globaltype_t. 856 * 857 * \fn const wasm_functype_t* wasm_externtype_as_functype_const(const wasm_externtype_t *) 858 * \brief Attempts to convert a #wasm_externtype_t to a #wasm_functype_t 859 * 860 * The returned value is owned by the #wasm_functype_t argument and should not 861 * be deleted. Returns `NULL` if the provided argument is not a 862 * #wasm_functype_t. 863 * 864 * \fn const wasm_tabletype_t* wasm_externtype_as_tabletype_const(const wasm_externtype_t *) 865 * \brief Attempts to convert a #wasm_externtype_t to a #wasm_tabletype_t 866 * 867 * The returned value is owned by the #wasm_tabletype_t argument and should not 868 * be deleted. Returns `NULL` if the provided argument is not a 869 * #wasm_tabletype_t. 870 * 871 * \fn const wasm_memorytype_t* wasm_externtype_as_memorytype_const(const wasm_externtype_t *) 872 * \brief Attempts to convert a #wasm_externtype_t to a #wasm_memorytype_t 873 * 874 * The returned value is owned by the #wasm_memorytype_t argument and should not 875 * be deleted. Returns `NULL` if the provided argument is not a 876 * #wasm_memorytype_t. 877 * 878 * \fn const wasm_tagtype_t* wasm_externtype_as_tagtype_const(const wasm_externtype_t *) 879 * \brief Attempts to convert a #wasm_externtype_t to a #wasm_tagtype_t 880 * 881 * The returned value is owned by the #wasm_tagtype_t argument and should not 882 * be deleted. Returns `NULL` if the provided argument is not a 883 * #wasm_tagtype_t. 884 * 885 * \fn const wasm_globaltype_t* wasm_externtype_as_globaltype_const(const wasm_externtype_t *) 886 * \brief Attempts to convert a #wasm_externtype_t to a #wasm_globaltype_t 887 * 888 * The returned value is owned by the #wasm_globaltype_t argument and should not 889 * be deleted. Returns `NULL` if the provided argument is not a 890 * #wasm_globaltype_t. 891 */ 892 893 /** 894 * \struct wasm_importtype_t 895 * \brief An opaque object representing the type of an import. 896 * 897 * \typedef wasm_importtype_t 898 * \brief Convenience alias for #wasm_importtype_t 899 * 900 * \struct wasm_importtype_vec_t 901 * \brief A list of #wasm_importtype_t values. 902 * 903 * \var wasm_importtype_vec_t::size 904 * \brief Length of this vector. 905 * 906 * \var wasm_importtype_vec_t::data 907 * \brief Pointer to the base of this vector 908 * 909 * \typedef wasm_importtype_vec_t 910 * \brief Convenience alias for #wasm_importtype_vec_t 911 * 912 * \fn void wasm_importtype_delete(wasm_importtype_t *); 913 * \brief Deletes a type. 914 * 915 * \fn void wasm_importtype_vec_new_empty(wasm_importtype_vec_t *out); 916 * \brief Creates an empty vector. 917 * 918 * See #wasm_byte_vec_new_empty for more information. 919 * 920 * \fn void wasm_importtype_vec_new_uninitialized(wasm_importtype_vec_t *out, size_t); 921 * \brief Creates a vector with the given capacity. 922 * 923 * See #wasm_byte_vec_new_uninitialized for more information. 924 * 925 * \fn void wasm_importtype_vec_new(wasm_importtype_vec_t *out, size_t, wasm_importtype_t *const[]); 926 * \brief Creates a vector with the provided contents. 927 * 928 * See #wasm_byte_vec_new for more information. 929 * 930 * \fn void wasm_importtype_vec_copy(wasm_importtype_vec_t *out, const wasm_importtype_vec_t *) 931 * \brief Copies one vector to another 932 * 933 * See #wasm_byte_vec_copy for more information. 934 * 935 * \fn void wasm_importtype_vec_delete(wasm_importtype_vec_t *out) 936 * \brief Deallocates import for a vector. 937 * 938 * See #wasm_byte_vec_delete for more information. 939 * 940 * \fn wasm_importtype_t* wasm_importtype_copy(const wasm_importtype_t *) 941 * \brief Creates a new value which matches the provided one. 942 * 943 * The caller is responsible for deleting the returned value. 944 * 945 * \fn wasm_importtype_t* wasm_importtype_new(wasm_name_t *module, wasm_name_t *name, wasm_externtype_t *) 946 * \brief Creates a new import type. 947 * 948 * This function takes ownership of the `module`, `name`, and 949 * #wasm_externtype_t arguments. The caller is responsible for deleting the 950 * returned value. Note that `name` can be `NULL` where in the module linking 951 * proposal the import name can be omitted. 952 * 953 * \fn const wasm_name_t* wasm_importtype_module(const wasm_importtype_t *); 954 * \brief Returns the module this import is importing from. 955 * 956 * The returned memory is owned by the #wasm_importtype_t argument, the caller 957 * should not deallocate it. 958 * 959 * \fn const wasm_name_t* wasm_importtype_name(const wasm_importtype_t *); 960 * \brief Returns the name this import is importing from. 961 * 962 * The returned memory is owned by the #wasm_importtype_t argument, the caller 963 * should not deallocate it. Note that `NULL` can be returned which means 964 * that the import name is not provided. This is for imports with the module 965 * linking proposal that only have the module specified. 966 * 967 * \fn const wasm_externtype_t* wasm_importtype_type(const wasm_importtype_t *); 968 * \brief Returns the type of item this import is importing. 969 * 970 * The returned memory is owned by the #wasm_importtype_t argument, the caller 971 * should not deallocate it. 972 */ 973 974 /** 975 * \struct wasm_exporttype_t 976 * \brief An opaque object representing the type of an export. 977 * 978 * \typedef wasm_exporttype_t 979 * \brief Convenience alias for #wasm_exporttype_t 980 * 981 * \struct wasm_exporttype_vec_t 982 * \brief A list of #wasm_exporttype_t values. 983 * 984 * \var wasm_exporttype_vec_t::size 985 * \brief Length of this vector. 986 * 987 * \var wasm_exporttype_vec_t::data 988 * \brief Pointer to the base of this vector 989 * 990 * \typedef wasm_exporttype_vec_t 991 * \brief Convenience alias for #wasm_exporttype_vec_t 992 * 993 * \fn void wasm_exporttype_delete(wasm_exporttype_t *); 994 * \brief Deletes a type. 995 * 996 * \fn void wasm_exporttype_vec_new_empty(wasm_exporttype_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_exporttype_vec_new_uninitialized(wasm_exporttype_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_exporttype_vec_new(wasm_exporttype_vec_t *out, size_t, wasm_exporttype_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_exporttype_vec_copy(wasm_exporttype_vec_t *out, const wasm_exporttype_vec_t *) 1012 * \brief Copies one vector to another 1013 * 1014 * See #wasm_byte_vec_copy for more information. 1015 * 1016 * \fn void wasm_exporttype_vec_delete(wasm_exporttype_vec_t *out) 1017 * \brief Deallocates export for a vector. 1018 * 1019 * See #wasm_byte_vec_delete for more information. 1020 * 1021 * \fn wasm_exporttype_t* wasm_exporttype_copy(const wasm_exporttype_t *) 1022 * \brief Creates a new value which matches the provided one. 1023 * 1024 * The caller is responsible for deleting the returned value. 1025 * 1026 * \fn wasm_exporttype_t* wasm_exporttype_new(wasm_name_t *name, wasm_externtype_t *) 1027 * \brief Creates a new export type. 1028 * 1029 * This function takes ownership of the `name` and 1030 * #wasm_externtype_t arguments. The caller is responsible for deleting the 1031 * returned value. 1032 * 1033 * \fn const wasm_name_t* wasm_exporttype_name(const wasm_exporttype_t *); 1034 * \brief Returns the name of this export. 1035 * 1036 * The returned memory is owned by the #wasm_exporttype_t argument, the caller 1037 * should not deallocate it. 1038 * 1039 * \fn const wasm_externtype_t* wasm_exporttype_type(const wasm_exporttype_t *); 1040 * \brief Returns the type of this export. 1041 * 1042 * The returned memory is owned by the #wasm_exporttype_t argument, the caller 1043 * should not deallocate it. 1044 */ 1045 1046 /** 1047 * \struct wasm_val_t 1048 * \brief Representation of a WebAssembly value. 1049 * 1050 * Note that this structure is intended to represent the way to communicate 1051 * values from the embedder to the engine. This type is not actually the 1052 * internal representation in JIT code, for example. 1053 * 1054 * Also note that this is an owned value, notably the `ref` field. The 1055 * #wasm_val_delete function does not delete the memory holding the #wasm_val_t 1056 * itself, but only the memory pointed to by #wasm_val_t. 1057 * 1058 * \var wasm_val_t::kind 1059 * \brief The kind of this value, or which of the fields in the `of` payload 1060 * contains the actual value. 1061 * 1062 * \var wasm_val_t::of 1063 * \brief The actual value of this #wasm_val_t. Only one field of this 1064 * anonymous union is valid, and which field is valid is defined by the `kind` 1065 * field. 1066 * 1067 * \var wasm_val_t::@0::i32 1068 * \brief value for the `WASM_I32` type 1069 * 1070 * \var wasm_val_t::@0::i64 1071 * \brief value for the `WASM_I64` type 1072 * 1073 * \var wasm_val_t::@0::f32 1074 * \brief value for the `WASM_F32` type 1075 * 1076 * \var wasm_val_t::@0::f64 1077 * \brief value for the `WASM_F64` type 1078 * 1079 * \var wasm_val_t::@0::ref 1080 * \brief Unused by Wasmtime. 1081 * 1082 * \typedef wasm_val_t 1083 * \brief Convenience alias for #wasm_val_t 1084 * 1085 * \struct wasm_val_vec_t 1086 * \brief A list of #wasm_val_t values. 1087 * 1088 * \var wasm_val_vec_t::size 1089 * \brief Length of this vector. 1090 * 1091 * \var wasm_val_vec_t::data 1092 * \brief Pointer to the base of this vector 1093 * 1094 * \typedef wasm_val_vec_t 1095 * \brief Convenience alias for #wasm_val_vec_t 1096 * 1097 * \fn void wasm_val_delete(wasm_val_t *v); 1098 * \brief Deletes a type. 1099 * 1100 * This does not delete the memory pointed to by `v`, so it's safe for `v` to 1101 * reside on the stack. Instead this only deletes the memory referenced by `v`, 1102 * such as the `ref` variant of #wasm_val_t. 1103 * 1104 * \fn void wasm_val_vec_new_empty(wasm_val_vec_t *out); 1105 * \brief Creates an empty vector. 1106 * 1107 * See #wasm_byte_vec_new_empty for more information. 1108 * 1109 * \fn void wasm_val_vec_new_uninitialized(wasm_val_vec_t *out, size_t); 1110 * \brief Creates a vector with the given capacity. 1111 * 1112 * See #wasm_byte_vec_new_uninitialized for more information. 1113 * 1114 * \fn void wasm_val_vec_new(wasm_val_vec_t *out, size_t, wasm_val_t const[]); 1115 * \brief Creates a vector with the provided contents. 1116 * 1117 * See #wasm_byte_vec_new for more information. 1118 * 1119 * \fn void wasm_val_vec_copy(wasm_val_vec_t *out, const wasm_val_vec_t *) 1120 * \brief Copies one vector to another 1121 * 1122 * See #wasm_byte_vec_copy for more information. 1123 * 1124 * \fn void wasm_val_vec_delete(wasm_val_vec_t *out) 1125 * \brief Deallocates export for a vector. 1126 * 1127 * See #wasm_byte_vec_delete for more information. 1128 * 1129 * \fn void wasm_val_copy(wasm_val_t *out, const wasm_val_t *) 1130 * \brief Copies a #wasm_val_t to a new one. 1131 * 1132 * The second argument to this function is copied to the first. The caller is 1133 * responsible for calling #wasm_val_delete on the first argument after this 1134 * function. The `out` parameter is assumed uninitialized by this function and 1135 * the previous contents will not be deallocated. 1136 */ 1137 1138 /** 1139 * \struct wasm_ref_t 1140 * \brief A reference type: either a funcref or an externref. 1141 * 1142 * \typedef wasm_ref_t 1143 * \brief Convenience alias for #wasm_ref_t 1144 * 1145 * \fn void wasm_ref_delete(wasm_ref_t *v); 1146 * \brief Delete a reference. 1147 * 1148 * \fn wasm_ref_t *wasm_ref_copy(const wasm_ref_t *) 1149 * \brief Copy a reference. 1150 * 1151 * \fn bool wasm_ref_same(const wasm_ref_t *, const wasm_ref_t *) 1152 * \brief Are the given references pointing to the same externref? 1153 * 1154 * > Note: Wasmtime does not support checking funcrefs for equality, and this 1155 * > function will always return false for funcrefs. 1156 * 1157 * \fn void* wasm_ref_get_host_info(const wasm_ref_t *); 1158 * \brief Unimplemented in Wasmtime, always returns `NULL`. 1159 * 1160 * \fn void wasm_ref_set_host_info(wasm_ref_t *, void *); 1161 * \brief Unimplemented in Wasmtime, aborts the process if called. 1162 * 1163 * \fn void wasm_ref_set_host_info_with_finalizer(wasm_ref_t *, void *, void(*)(void*)); 1164 * \brief Unimplemented in Wasmtime, aborts the process if called. 1165 */ 1166 1167 /** 1168 * \struct wasm_frame_t 1169 * \brief Opaque struct representing a frame of a wasm stack trace. 1170 * 1171 * \typedef wasm_frame_t 1172 * \brief Convenience alias for #wasm_frame_t 1173 * 1174 * \struct wasm_frame_vec_t 1175 * \brief A list of #wasm_frame_t frameues. 1176 * 1177 * \var wasm_frame_vec_t::size 1178 * \brief Length of this vector. 1179 * 1180 * \var wasm_frame_vec_t::data 1181 * \brief Pointer to the base of this vector 1182 * 1183 * \typedef wasm_frame_vec_t 1184 * \brief Convenience alias for #wasm_frame_vec_t 1185 * 1186 * \fn void wasm_frame_delete(wasm_frame_t *v); 1187 * \brief Deletes a frame. 1188 * 1189 * \fn void wasm_frame_vec_new_empty(wasm_frame_vec_t *out); 1190 * \brief Creates an empty vector. 1191 * 1192 * See #wasm_byte_vec_new_empty for more information. 1193 * 1194 * \fn void wasm_frame_vec_new_uninitialized(wasm_frame_vec_t *out, size_t); 1195 * \brief Creates a vector with the given capacity. 1196 * 1197 * See #wasm_byte_vec_new_uninitialized for more information. 1198 * 1199 * \fn void wasm_frame_vec_new(wasm_frame_vec_t *out, size_t, wasm_frame_t *const[]); 1200 * \brief Creates a vector with the provided contents. 1201 * 1202 * See #wasm_byte_vec_new for more information. 1203 * 1204 * \fn void wasm_frame_vec_copy(wasm_frame_vec_t *out, const wasm_frame_vec_t *) 1205 * \brief Copies one vector to another 1206 * 1207 * See #wasm_byte_vec_copy for more information. 1208 * 1209 * \fn void wasm_frame_vec_delete(wasm_frame_vec_t *out) 1210 * \brief Deallocates export for a vector. 1211 * 1212 * See #wasm_byte_vec_delete for more information. 1213 * 1214 * \fn wasm_frame_t *wasm_frame_copy(const wasm_frame_t *) 1215 * \brief Returns a copy of the provided frame. 1216 * 1217 * The caller is expected to call #wasm_frame_delete on the returned frame. 1218 * 1219 * \fn wasm_instance_t *wasm_frame_instance(const wasm_frame_t *); 1220 * \brief Unimplemented in Wasmtime, aborts the process if called. 1221 * 1222 * \fn uint32_t wasm_frame_func_index(const wasm_frame_t *); 1223 * \brief Returns the function index in the original wasm module that this frame 1224 * corresponds to. 1225 * 1226 * \fn uint32_t wasm_frame_func_offset(const wasm_frame_t *); 1227 * \brief Returns the byte offset from the beginning of the function in the 1228 * original wasm file to the instruction this frame points to. 1229 * 1230 * \fn uint32_t wasm_frame_module_offset(const wasm_frame_t *); 1231 * \brief Returns the byte offset from the beginning of the original wasm file 1232 * to the instruction this frame points to. 1233 */ 1234 1235 /** 1236 * \struct wasm_trap_t 1237 * \brief Opaque struct representing a wasm trap. 1238 * 1239 * \typedef wasm_trap_t 1240 * \brief Convenience alias for #wasm_trap_t 1241 * 1242 * \fn void wasm_trap_delete(wasm_trap_t *v); 1243 * \brief Deletes a trap. 1244 * 1245 * \fn wasm_trap_t *wasm_trap_copy(const wasm_trap_t *) 1246 * \brief Copies a #wasm_trap_t to a new one. 1247 * 1248 * The caller is responsible for deleting the returned #wasm_trap_t. 1249 * 1250 * \fn void wasm_trap_same(const wasm_trap_t *, const wasm_trap_t *) 1251 * \brief Unimplemented in Wasmtime, aborts the process if called. 1252 * 1253 * \fn void* wasm_trap_get_host_info(const wasm_trap_t *); 1254 * \brief Unimplemented in Wasmtime, always returns `NULL`. 1255 * 1256 * \fn void wasm_trap_set_host_info(wasm_trap_t *, void *); 1257 * \brief Unimplemented in Wasmtime, aborts the process if called. 1258 * 1259 * \fn void wasm_trap_set_host_info_with_finalizer(wasm_trap_t *, void *, void(*)(void*)); 1260 * \brief Unimplemented in Wasmtime, aborts the process if called. 1261 * 1262 * \fn wasm_ref_t *wasm_trap_as_ref(wasm_trap_t *); 1263 * \brief Unimplemented in Wasmtime, aborts the process if called. 1264 * 1265 * \fn wasm_trap_t *wasm_ref_as_trap(wasm_ref_t *); 1266 * \brief Unimplemented in Wasmtime, aborts the process if called. 1267 * 1268 * \fn const wasm_ref_t *wasm_trap_as_ref_const(const wasm_trap_t *); 1269 * \brief Unimplemented in Wasmtime, aborts the process if called. 1270 * 1271 * \fn const wasm_trap_t *wasm_ref_as_trap_const(const wasm_ref_t *); 1272 * \brief Unimplemented in Wasmtime, aborts the process if called. 1273 * 1274 * \fn wasm_trap_t *wasm_trap_new(wasm_store_t *store, const wasm_message_t *); 1275 * \brief Creates a new #wasm_trap_t with the provided message. 1276 * 1277 * This function will create a new trap within the given #wasm_store_t with the 1278 * provided message. This will also capture the backtrace, if any, of wasm 1279 * frames on the stack. 1280 * 1281 * Note that the #wasm_message_t argument is expected to have a 0-byte at the 1282 * end of the message, and the length should include the trailing 0-byte. 1283 * 1284 * This function does not take ownership of either argument. 1285 * 1286 * The caller is responsible for deallocating the trap returned. 1287 * 1288 * \fn void wasm_trap_message(const wasm_trap_t *, wasm_message_t *out); 1289 * \brief Retrieves the message associated with this trap. 1290 * 1291 * The caller takes ownership of the returned `out` value and is responsible for 1292 * calling #wasm_byte_vec_delete on it. 1293 * 1294 * \fn wasm_frame_t* wasm_trap_origin(const wasm_trap_t *); 1295 * \brief Returns the top frame of the wasm stack responsible for this trap. 1296 * 1297 * The caller is responsible for deallocating the returned frame. This function 1298 * may return `NULL`, for example, for traps created when there wasn't anything 1299 * on the wasm stack. 1300 * 1301 * \fn void wasm_trap_trace(const wasm_trap_t *, wasm_frame_vec_t *out); 1302 * \brief Returns the trace of wasm frames for this trap. 1303 * 1304 * The caller is responsible for deallocating the returned list of frames. 1305 * Frames are listed in order of increasing depth, with the most recently called 1306 * function at the front of the list and the base function on the stack at the 1307 * end. 1308 */ 1309 1310 /** 1311 * \struct wasm_foreign_t 1312 * \brief Unimplemented in Wasmtime 1313 * 1314 * \typedef wasm_foreign_t 1315 * \brief Convenience alias for #wasm_foreign_t 1316 * 1317 * \fn void wasm_foreign_delete(wasm_foreign_t *v); 1318 * \brief Unimplemented in Wasmtime, aborts the process if called 1319 * 1320 * \fn wasm_foreign_t *wasm_foreign_copy(const wasm_foreign_t *) 1321 * \brief Unimplemented in Wasmtime, aborts the process if called 1322 * 1323 * \fn void wasm_foreign_same(const wasm_foreign_t *, const wasm_foreign_t *) 1324 * \brief Unimplemented in Wasmtime, aborts the process if called. 1325 * 1326 * \fn void* wasm_foreign_get_host_info(const wasm_foreign_t *); 1327 * \brief Unimplemented in Wasmtime, always returns `NULL`. 1328 * 1329 * \fn void wasm_foreign_set_host_info(wasm_foreign_t *, void *); 1330 * \brief Unimplemented in Wasmtime, aborts the process if called. 1331 * 1332 * \fn void wasm_foreign_set_host_info_with_finalizer(wasm_foreign_t *, void *, void(*)(void*)); 1333 * \brief Unimplemented in Wasmtime, aborts the process if called. 1334 * 1335 * \fn wasm_ref_t *wasm_foreign_as_ref(wasm_foreign_t *); 1336 * \brief Unimplemented in Wasmtime, aborts the process if called. 1337 * 1338 * \fn wasm_foreign_t *wasm_ref_as_foreign(wasm_ref_t *); 1339 * \brief Unimplemented in Wasmtime, aborts the process if called. 1340 * 1341 * \fn const wasm_ref_t *wasm_foreign_as_ref_const(const wasm_foreign_t *); 1342 * \brief Unimplemented in Wasmtime, aborts the process if called. 1343 * 1344 * \fn const wasm_foreign_t *wasm_ref_as_foreign_const(const wasm_ref_t *); 1345 * \brief Unimplemented in Wasmtime, aborts the process if called. 1346 * 1347 * \fn wasm_foreign_t *wasm_foreign_new(wasm_store_t *store); 1348 * \brief Unimplemented in Wasmtime, aborts the process if called. 1349 */ 1350 1351 /** 1352 * \struct wasm_module_t 1353 * \brief Opaque struct representing a compiled wasm module. 1354 * 1355 * This structure is safe to send across threads in Wasmtime. 1356 * 1357 * \typedef wasm_module_t 1358 * \brief Convenience alias for #wasm_module_t 1359 * 1360 * \struct wasm_shared_module_t 1361 * \brief Opaque struct representing module that can be sent between threads. 1362 * 1363 * This structure is safe to send across threads in Wasmtime. Note that in 1364 * Wasmtime #wasm_module_t is also safe to share across threads. 1365 * 1366 * \typedef wasm_shared_module_t 1367 * \brief Convenience alias for #wasm_shared_module_t 1368 * 1369 * \fn void wasm_module_delete(wasm_module_t *v); 1370 * \brief Deletes a module. 1371 * 1372 * \fn wasm_module_t *wasm_module_copy(const wasm_module_t *) 1373 * \brief Copies a #wasm_module_t to a new one. 1374 * 1375 * The caller is responsible for deleting the returned #wasm_module_t. 1376 * 1377 * \fn void wasm_module_same(const wasm_module_t *, const wasm_module_t *) 1378 * \brief Unimplemented in Wasmtime, aborts the process if called. 1379 * 1380 * \fn void* wasm_module_get_host_info(const wasm_module_t *); 1381 * \brief Unimplemented in Wasmtime, always returns `NULL`. 1382 * 1383 * \fn void wasm_module_set_host_info(wasm_module_t *, void *); 1384 * \brief Unimplemented in Wasmtime, aborts the process if called. 1385 * 1386 * \fn void wasm_module_set_host_info_with_finalizer(wasm_module_t *, void *, void(*)(void*)); 1387 * \brief Unimplemented in Wasmtime, aborts the process if called. 1388 * 1389 * \fn wasm_ref_t *wasm_module_as_ref(wasm_module_t *); 1390 * \brief Unimplemented in Wasmtime, aborts the process if called. 1391 * 1392 * \fn wasm_module_t *wasm_ref_as_module(wasm_ref_t *); 1393 * \brief Unimplemented in Wasmtime, aborts the process if called. 1394 * 1395 * \fn const wasm_ref_t *wasm_module_as_ref_const(const wasm_module_t *); 1396 * \brief Unimplemented in Wasmtime, aborts the process if called. 1397 * 1398 * \fn const wasm_module_t *wasm_ref_as_module_const(const wasm_ref_t *); 1399 * \brief Unimplemented in Wasmtime, aborts the process if called. 1400 * 1401 * \fn wasm_ref_as_module_const(const wasm_ref_t *); 1402 * \brief Unimplemented in Wasmtime, aborts the process if called. 1403 * 1404 * \fn void wasm_shared_module_delete(wasm_shared_module_t *); 1405 * \brief Deletes the provided module. 1406 * 1407 * \fn wasm_shared_module_t *wasm_module_share(const wasm_module_t *); 1408 * \brief Creates a shareable module from the provided module. 1409 * 1410 * > Note that this API is not necessary in Wasmtime because #wasm_module_t can 1411 * > be shared across threads. This is implemented for compatibility, however. 1412 * 1413 * This function does not take ownership of the argument, but the caller is 1414 * expected to deallocate the returned #wasm_shared_module_t. 1415 * 1416 * \fn wasm_module_t *wasm_module_obtain(wasm_store_t *, const wasm_shared_module_t *); 1417 * \brief Attempts to create a #wasm_module_t from the shareable module. 1418 * 1419 * > Note that this API is not necessary in Wasmtime because #wasm_module_t can 1420 * > be shared across threads. This is implemented for compatibility, however. 1421 * 1422 * This function does not take ownership of its arguments, but the caller is 1423 * expected to deallocate the returned #wasm_module_t. 1424 * 1425 * This function may fail if the engines associated with the #wasm_store_t or 1426 * #wasm_shared_module_t are different. 1427 * 1428 * \fn wasm_module_t *wasm_module_new(wasm_store_t *, const wasm_byte_vec_t *binary) 1429 * \brief Compiles a raw WebAssembly binary to a #wasm_module_t. 1430 * 1431 * This function will validate and compile the provided binary. The returned 1432 * #wasm_module_t is ready for instantiation after this call returns. 1433 * 1434 * This function does not take ownership of its arguments, but the caller is 1435 * expected to deallocate the returned #wasm_module_t. 1436 * 1437 * This function may fail if the provided binary is not a WebAssembly binary or 1438 * if it does not pass validation. In these cases this function returns `NULL`. 1439 * 1440 * \fn bool wasm_module_validate(wasm_store_t *, const wasm_byte_vec_t *binary); 1441 * \brief Validates whether a provided byte sequence is a valid wasm binary. 1442 * 1443 * This function will perform any internal validation necessary to determine if 1444 * `binary` is a valid WebAssembly binary according to the configuration of the 1445 * #wasm_store_t provided. 1446 * 1447 * \fn void wasm_module_imports(const wasm_module_t *, wasm_importtype_vec_t *out); 1448 * \brief Returns the list of imports that this module expects. 1449 * 1450 * The list of imports returned are the types of items expected to be passed to 1451 * #wasm_instance_new. You can use #wasm_importtype_type to learn about the 1452 * expected type of each import. 1453 * 1454 * This function does not take ownership of the provided module but ownership of 1455 * `out` is passed to the caller. Note that `out` is treated as uninitialized 1456 * when passed to this function. 1457 * 1458 * \fn void wasm_module_exports(const wasm_module_t *, wasm_exporttype_vec_t *out); 1459 * \brief Returns the list of exports that this module provides. 1460 * 1461 * The list of exports returned are in the same order as the items returned by 1462 * #wasm_instance_exports. 1463 * 1464 * This function does not take ownership of the provided module but ownership 1465 * of `out` is passed to the caller. Note that `out` is treated as 1466 * uninitialized when passed to this function. 1467 * 1468 * \fn void wasm_module_serialize(const wasm_module_t *, wasm_byte_vec_t *out); 1469 * \brief Serializes the provided module to a byte vector. 1470 * 1471 * Does not take ownership of the input module but expects the caller will 1472 * deallocate the `out` vector. The byte vector can later be deserialized 1473 * through #wasm_module_deserialize. 1474 * 1475 * \fn wasm_module_t *wasm_module_deserialize(wasm_store_t *, const wasm_byte_vec_t *); 1476 * \brief Deserializes a previously-serialized module. 1477 * 1478 * The input bytes must have been created from a previous call to 1479 * #wasm_module_serialize. 1480 */ 1481 1482 /** 1483 * \struct wasm_func_t 1484 * \brief Opaque struct representing a compiled wasm function. 1485 * 1486 * \typedef wasm_func_t 1487 * \brief Convenience alias for #wasm_func_t 1488 * 1489 * \typedef wasm_func_callback_t 1490 * \brief Type definition for functions passed to #wasm_func_new. 1491 * 1492 * This is the type signature of a host function created with #wasm_func_new. 1493 * This function takes two parameters, the first of which is the list of 1494 * parameters to the function and the second of which is where to write the 1495 * results. This function can optionally return a #wasm_trap_t and does not have 1496 * to fill in the results in that case. 1497 * 1498 * It is guaranteed that this function will be called with the appropriate 1499 * number and types of arguments according to the function type passed to 1500 * #wasm_func_new. It is required that this function produces the correct number 1501 * and types of results as the original type signature. It is undefined behavior 1502 * to return other types or different numbers of values. 1503 * 1504 * Ownership of the results and the trap returned, if any, is passed to the 1505 * caller of this function. 1506 * 1507 * \typedef wasm_func_callback_with_env_t 1508 * \brief Type definition for functions passed to #wasm_func_new_with_env 1509 * 1510 * The semantics of this function are the same as those of 1511 * #wasm_func_callback_t, except the first argument is the same `void*` argument 1512 * passed to #wasm_func_new_with_env. 1513 * 1514 * \fn void wasm_func_delete(wasm_func_t *v); 1515 * \brief Deletes a func. 1516 * 1517 * \fn wasm_func_t *wasm_func_copy(const wasm_func_t *) 1518 * \brief Copies a #wasm_func_t to a new one. 1519 * 1520 * The caller is responsible for deleting the returned #wasm_func_t. 1521 * 1522 * \fn void wasm_func_same(const wasm_func_t *, const wasm_func_t *) 1523 * \brief Unimplemented in Wasmtime, aborts the process if called. 1524 * 1525 * \fn void* wasm_func_get_host_info(const wasm_func_t *); 1526 * \brief Unimplemented in Wasmtime, always returns `NULL`. 1527 * 1528 * \fn void wasm_func_set_host_info(wasm_func_t *, void *); 1529 * \brief Unimplemented in Wasmtime, aborts the process if called. 1530 * 1531 * \fn void wasm_func_set_host_info_with_finalizer(wasm_func_t *, void *, void(*)(void*)); 1532 * \brief Unimplemented in Wasmtime, aborts the process if called. 1533 * 1534 * \fn wasm_ref_t *wasm_func_as_ref(wasm_func_t *); 1535 * \brief Unimplemented in Wasmtime, aborts the process if called. 1536 * 1537 * \fn wasm_func_t *wasm_ref_as_func(wasm_ref_t *); 1538 * \brief Unimplemented in Wasmtime, aborts the process if called. 1539 * 1540 * \fn const wasm_ref_t *wasm_func_as_ref_const(const wasm_func_t *); 1541 * \brief Unimplemented in Wasmtime, aborts the process if called. 1542 * 1543 * \fn const wasm_func_t *wasm_ref_as_func_const(const wasm_ref_t *); 1544 * \brief Unimplemented in Wasmtime, aborts the process if called. 1545 * 1546 * \fn wasm_ref_as_func_const(const wasm_ref_t *); 1547 * \brief Unimplemented in Wasmtime, aborts the process if called. 1548 * 1549 * \fn wasm_func_t *wasm_func_new(wasm_store_t *, const wasm_functype_t *, wasm_func_callback_t); 1550 * \brief Creates a new WebAssembly function with host functionality. 1551 * 1552 * This function creates a new #wasm_func_t from a host-provided function. The 1553 * host provided function must implement the type signature matching the 1554 * #wasm_functype_t provided here. 1555 * 1556 * The returned #wasm_func_t is expected to be deleted by the caller. This 1557 * function does not take ownership of its arguments. 1558 * 1559 * \fn wasm_func_t *wasm_func_new_with_env( 1560 * wasm_store_t *, 1561 * const wasm_functype_t *type, 1562 * wasm_func_callback_with_env_t, 1563 * void *env, 1564 * void (*finalizer)(void *)); 1565 * \brief Creates a new WebAssembly function with host functionality. 1566 * 1567 * This function is the same as #wasm_func_new except that it the host-provided 1568 * `env` argument is passed to each invocation of the callback provided. This 1569 * provides a means of attaching host information to this #wasm_func_t. 1570 * 1571 * The `finalizer` argument will be invoked to deallocate `env` when the 1572 * #wasm_func_t is deallocated. If this argument is `NULL` then the data 1573 * provided will not be finalized. 1574 * 1575 * This function only takes ownership of the `env` argument (which is later 1576 * deallocated automatically by calling `finalizer`). This function yields 1577 * ownership of the returned #wasm_func_t to the caller. 1578 * 1579 * \fn wasm_functype_t *wasm_func_type(const wasm_func_t *); 1580 * \brief Returns the type of this function. 1581 * 1582 * The returned #wasm_functype_t is expected to be deallocated by the caller. 1583 * 1584 * \fn size_t wasm_func_param_arity(const wasm_func_t *); 1585 * \brief Returns the number of arguments expected by this function. 1586 * 1587 * \fn size_t wasm_func_result_arity(const wasm_func_t *); 1588 * \brief Returns the number of results returned by this function. 1589 * 1590 * \fn wasm_trap_t *wasm_func_call(const wasm_func_t *, const wasm_val_vec_t *args, wasm_val_vec_t *results); 1591 * \brief Calls the provided function with the arguments given. 1592 * 1593 * This function is used to call WebAssembly from the host. The parameter array 1594 * provided must be valid for #wasm_func_param_arity number of arguments, and 1595 * the result array must be valid for #wasm_func_result_arity number of results. 1596 * Providing not enough space is undefined behavior. 1597 * 1598 * If any of the arguments do not have the correct type then a trap is returned. 1599 * Additionally if any of the arguments come from a different store than 1600 * the #wasm_func_t provided a trap is returned. 1601 * 1602 * When no trap happens and no errors are detected then `NULL` is returned. The 1603 * `results` array is guaranteed to be filled in with values appropriate for 1604 * this function's type signature. 1605 * 1606 * If a trap happens during execution or some other error then a non-`NULL` trap 1607 * is returned. In this situation the `results` are is unmodified. 1608 * 1609 * Does not take ownership of `wasm_val_t` arguments. Gives ownership of 1610 * `wasm_val_t` results. 1611 */ 1612 1613 /** 1614 * \struct wasm_global_t 1615 * \brief Opaque struct representing a wasm global. 1616 * 1617 * \typedef wasm_global_t 1618 * \brief Convenience alias for #wasm_global_t 1619 * 1620 * \fn void wasm_global_delete(wasm_global_t *v); 1621 * \brief Deletes a global. 1622 * 1623 * \fn wasm_global_t *wasm_global_copy(const wasm_global_t *) 1624 * \brief Copies a #wasm_global_t to a new one. 1625 * 1626 * The caller is responsible for deleting the returned #wasm_global_t. 1627 * 1628 * \fn void wasm_global_same(const wasm_global_t *, const wasm_global_t *) 1629 * \brief Unimplemented in Wasmtime, aborts the process if called. 1630 * 1631 * \fn void* wasm_global_get_host_info(const wasm_global_t *); 1632 * \brief Unimplemented in Wasmtime, always returns `NULL`. 1633 * 1634 * \fn void wasm_global_set_host_info(wasm_global_t *, void *); 1635 * \brief Unimplemented in Wasmtime, aborts the process if called. 1636 * 1637 * \fn void wasm_global_set_host_info_with_finalizer(wasm_global_t *, void *, void(*)(void*)); 1638 * \brief Unimplemented in Wasmtime, aborts the process if called. 1639 * 1640 * \fn wasm_ref_t *wasm_global_as_ref(wasm_global_t *); 1641 * \brief Unimplemented in Wasmtime, aborts the process if called. 1642 * 1643 * \fn wasm_global_t *wasm_ref_as_global(wasm_ref_t *); 1644 * \brief Unimplemented in Wasmtime, aborts the process if called. 1645 * 1646 * \fn const wasm_ref_t *wasm_global_as_ref_const(const wasm_global_t *); 1647 * \brief Unimplemented in Wasmtime, aborts the process if called. 1648 * 1649 * \fn const wasm_global_t *wasm_ref_as_global_const(const wasm_ref_t *); 1650 * \brief Unimplemented in Wasmtime, aborts the process if called. 1651 * 1652 * \fn wasm_ref_as_global_const(const wasm_ref_t *); 1653 * \brief Unimplemented in Wasmtime, aborts the process if called. 1654 * 1655 * \fn wasm_global_t *wasm_global_new(wasm_store_t *, const wasm_globaltype_t *, const wasm_val_t *); 1656 * \brief Creates a new WebAssembly global. 1657 * 1658 * This function is used to create a wasm global from the host, typically to 1659 * provide as the import of a module. The type of the global is specified along 1660 * with the initial value. 1661 * 1662 * This function will return `NULL` on errors. Errors include: 1663 * 1664 * * The type of the global doesn't match the type of the value specified. 1665 * * The initialization value does not come from the provided #wasm_store_t. 1666 * 1667 * This function does not take ownership of any of its arguments. The caller is 1668 * expected to deallocate the returned value. 1669 * 1670 * \fn wasm_globaltype_t *wasm_global_type(const wasm_global_t *); 1671 * \brief Returns the type of this global. 1672 * 1673 * The caller is expected to deallocate the returned #wasm_globaltype_t. 1674 * 1675 * \fn void wasm_global_get(const wasm_global_t *, wasm_val_t *out); 1676 * \brief Gets the value of this global. 1677 * 1678 * The caller is expected to deallocate the returned #wasm_val_t. The provided 1679 * `out` argument is treated as uninitialized on input. 1680 * 1681 * \fn void wasm_global_set(wasm_global_t *, const wasm_val_t *); 1682 * \brief Sets the value of this global. 1683 * 1684 * This function will set the value of a global to a new value. This function 1685 * does nothing if the global is not mutable, if the #wasm_val_t argument has 1686 * the wrong type, or if the provided value comes from a different store as the 1687 * #wasm_global_t. 1688 * 1689 * This function does not take ownership of its arguments. 1690 */ 1691 1692 /** 1693 * \struct wasm_table_t 1694 * \brief Opaque struct representing a wasm table. 1695 * 1696 * \typedef wasm_table_t 1697 * \brief Convenience alias for #wasm_table_t 1698 * 1699 * \typedef wasm_table_size_t 1700 * \brief Typedef for indices and sizes of wasm tables. 1701 * 1702 * \fn void wasm_table_delete(wasm_table_t *v); 1703 * \brief Deletes a table. 1704 * 1705 * \fn wasm_table_t *wasm_table_copy(const wasm_table_t *) 1706 * \brief Copies a #wasm_table_t to a new one. 1707 * 1708 * The caller is responsible for deleting the returned #wasm_table_t. 1709 * 1710 * \fn void wasm_table_same(const wasm_table_t *, const wasm_table_t *) 1711 * \brief Unimplemented in Wasmtime, aborts the process if called. 1712 * 1713 * \fn void* wasm_table_get_host_info(const wasm_table_t *); 1714 * \brief Unimplemented in Wasmtime, always returns `NULL`. 1715 * 1716 * \fn void wasm_table_set_host_info(wasm_table_t *, void *); 1717 * \brief Unimplemented in Wasmtime, aborts the process if called. 1718 * 1719 * \fn void wasm_table_set_host_info_with_finalizer(wasm_table_t *, void *, void(*)(void*)); 1720 * \brief Unimplemented in Wasmtime, aborts the process if called. 1721 * 1722 * \fn wasm_ref_t *wasm_table_as_ref(wasm_table_t *); 1723 * \brief Unimplemented in Wasmtime, aborts the process if called. 1724 * 1725 * \fn wasm_table_t *wasm_ref_as_table(wasm_ref_t *); 1726 * \brief Unimplemented in Wasmtime, aborts the process if called. 1727 * 1728 * \fn const wasm_ref_t *wasm_table_as_ref_const(const wasm_table_t *); 1729 * \brief Unimplemented in Wasmtime, aborts the process if called. 1730 * 1731 * \fn const wasm_table_t *wasm_ref_as_table_const(const wasm_ref_t *); 1732 * \brief Unimplemented in Wasmtime, aborts the process if called. 1733 * 1734 * \fn wasm_ref_as_table_const(const wasm_ref_t *); 1735 * \brief Unimplemented in Wasmtime, aborts the process if called. 1736 * 1737 * \fn wasm_table_t *wasm_table_new(wasm_store_t *, const wasm_tabletype_t *, wasm_ref_t *init); 1738 * \brief Creates a new WebAssembly table. 1739 * 1740 * Creates a new host-defined table of values. This table has the type provided 1741 * and is filled with the provided initial value (which can be `NULL`). 1742 * 1743 * Returns an error if the #wasm_ref_t does not match the element type of the 1744 * table provided or if it comes from a different store than the one provided. 1745 * 1746 * Does not take ownship of the `init` value. 1747 * 1748 * \fn wasm_tabletype_t *wasm_table_type(const wasm_table_t *); 1749 * \brief Returns the type of this table. 1750 * 1751 * The caller is expected to deallocate the returned #wasm_tabletype_t. 1752 * 1753 * \fn wasm_ref_t *wasm_table_get(const wasm_table_t *, wasm_table_size_t index); 1754 * \brief Gets an element from this table. 1755 * 1756 * Attempts to get a value at an index in this table. This function returns 1757 * `NULL` if the index is out of bounds. 1758 * 1759 * Gives ownership of the resulting `wasm_ref_t*`. 1760 * 1761 * \fn void wasm_table_set(wasm_table_t *, wasm_table_size_t index, wasm_ref_t *); 1762 * \brief Sets an element in this table. 1763 * 1764 * Attempts to set a value at an index in this table. This function does nothing 1765 * in erroneous situations such as: 1766 * 1767 * * The index is out of bounds. 1768 * * The #wasm_ref_t comes from a different store than the table provided. 1769 * * The #wasm_ref_t does not have an appropriate type to store in this table. 1770 * 1771 * Does not take ownership of the given `wasm_ref_t*`. 1772 * 1773 * \fn wasm_table_size_t wasm_table_size(const wasm_table_t *); 1774 * \brief Gets the current size, in elements, of this table. 1775 * 1776 * \fn bool wasm_table_grow(wasm_table_t *, wasm_table_size_t delta, wasm_ref_t *init); 1777 * \brief Attempts to grow this table by `delta` elements. 1778 * 1779 * This function will grow the table by `delta` elements, initializing all new 1780 * elements to the `init` value provided. 1781 * 1782 * If growth happens successfully, then `true` is returned. Otherwise `false` is 1783 * returned and indicates one possible form of failure: 1784 * 1785 * * The table's limits do not allow growth by `delta`. 1786 * * The #wasm_ref_t comes from a different store than the table provided. 1787 * * The #wasm_ref_t does not have an appropriate type to store in this table. 1788 * 1789 * Does not take ownership of the given `init` value. 1790 */ 1791 1792 /** 1793 * \struct wasm_memory_t 1794 * \brief Opaque struct representing a wasm memory. 1795 * 1796 * \typedef wasm_memory_t 1797 * \brief Convenience alias for #wasm_memory_t 1798 * 1799 * \typedef wasm_memory_pages_t 1800 * \brief Unsigned integer to hold the number of pages a memory has. 1801 * 1802 * \fn void wasm_memory_delete(wasm_memory_t *v); 1803 * \brief Deletes a memory. 1804 * 1805 * \fn wasm_memory_t *wasm_memory_copy(const wasm_memory_t *) 1806 * \brief Copies a #wasm_memory_t to a new one. 1807 * 1808 * The caller is responsible for deleting the returned #wasm_memory_t. 1809 * 1810 * \fn void wasm_memory_same(const wasm_memory_t *, const wasm_memory_t *) 1811 * \brief Unimplemented in Wasmtime, aborts the process if called. 1812 * 1813 * \fn void* wasm_memory_get_host_info(const wasm_memory_t *); 1814 * \brief Unimplemented in Wasmtime, always returns `NULL`. 1815 * 1816 * \fn void wasm_memory_set_host_info(wasm_memory_t *, void *); 1817 * \brief Unimplemented in Wasmtime, aborts the process if called. 1818 * 1819 * \fn void wasm_memory_set_host_info_with_finalizer(wasm_memory_t *, void *, void(*)(void*)); 1820 * \brief Unimplemented in Wasmtime, aborts the process if called. 1821 * 1822 * \fn wasm_ref_t *wasm_memory_as_ref(wasm_memory_t *); 1823 * \brief Unimplemented in Wasmtime, aborts the process if called. 1824 * 1825 * \fn wasm_memory_t *wasm_ref_as_memory(wasm_ref_t *); 1826 * \brief Unimplemented in Wasmtime, aborts the process if called. 1827 * 1828 * \fn const wasm_ref_t *wasm_memory_as_ref_const(const wasm_memory_t *); 1829 * \brief Unimplemented in Wasmtime, aborts the process if called. 1830 * 1831 * \fn const wasm_memory_t *wasm_ref_as_memory_const(const wasm_ref_t *); 1832 * \brief Unimplemented in Wasmtime, aborts the process if called. 1833 * 1834 * \fn wasm_ref_as_memory_const(const wasm_ref_t *); 1835 * \brief Unimplemented in Wasmtime, aborts the process if called. 1836 * 1837 * \fn wasm_memory_t *wasm_memory_new(wasm_store_t *, const wasm_memorytype_t *); 1838 * \brief Creates a new WebAssembly memory. 1839 * 1840 * \fn wasm_memorytype_t *wasm_memory_type(const wasm_memory_t *); 1841 * \brief Returns the type of this memory. 1842 * 1843 * The caller is expected to deallocate the returned #wasm_memorytype_t. 1844 * 1845 * \fn byte_t *wasm_memory_data(wasm_memory_t *); 1846 * \brief Returns the base address, in memory, where this memory is located. 1847 * 1848 * Note that the returned address may change over time when growth happens. The 1849 * returned pointer is only valid until the memory is next grown (which could 1850 * happen in wasm itself). 1851 * 1852 * \fn size_t wasm_memory_data_size(const wasm_memory_t *); 1853 * \brief Returns the size, in bytes, of this memory. 1854 * 1855 * \fn wasm_memory_pages_t wasm_memory_size(const wasm_memory_t *); 1856 * \brief Returns the size, in wasm pages, of this memory. 1857 * 1858 * \fn bool wasm_memory_grow(wasm_memory_t *, wasm_memory_pages_t delta); 1859 * \brief Attempts to grow this memory by `delta` wasm pages. 1860 * 1861 * This function is similar to the `memory.grow` instruction in wasm itself. It 1862 * will attempt to grow the memory by `delta` wasm pages. If growth fails then 1863 * `false` is returned, otherwise `true` is returned. 1864 */ 1865 1866 /** 1867 * \struct wasm_extern_t 1868 * \brief Opaque struct representing a wasm external value. 1869 * 1870 * \typedef wasm_extern_t 1871 * \brief Convenience alias for #wasm_extern_t 1872 * 1873 * \struct wasm_extern_vec_t 1874 * \brief A list of #wasm_extern_t values. 1875 * 1876 * \var wasm_extern_vec_t::size 1877 * \brief Length of this vector. 1878 * 1879 * \var wasm_extern_vec_t::data 1880 * \brief Pointer to the base of this vector 1881 * 1882 * \typedef wasm_extern_vec_t 1883 * \brief Convenience alias for #wasm_extern_vec_t 1884 * 1885 * \fn void wasm_extern_delete(wasm_extern_t *v); 1886 * \brief Deletes a extern. 1887 * 1888 * \fn void wasm_extern_vec_new_empty(wasm_extern_vec_t *out); 1889 * \brief Creates an empty vector. 1890 * 1891 * See #wasm_byte_vec_new_empty for more information. 1892 * 1893 * \fn void wasm_extern_vec_new_uninitialized(wasm_extern_vec_t *out, size_t); 1894 * \brief Creates a vector with the given capacity. 1895 * 1896 * See #wasm_byte_vec_new_uninitialized for more information. 1897 * 1898 * \fn void wasm_extern_vec_new(wasm_extern_vec_t *out, size_t, wasm_extern_t *const[]); 1899 * \brief Creates a vector with the provided contents. 1900 * 1901 * See #wasm_byte_vec_new for more information. 1902 * 1903 * \fn void wasm_extern_vec_copy(wasm_extern_vec_t *out, const wasm_extern_vec_t *) 1904 * \brief Copies one vector to another 1905 * 1906 * See #wasm_byte_vec_copy for more information. 1907 * 1908 * \fn void wasm_extern_vec_delete(wasm_extern_vec_t *out) 1909 * \brief Deallocates import for a vector. 1910 * 1911 * See #wasm_byte_vec_delete for more information. 1912 * 1913 * \fn wasm_extern_t *wasm_extern_copy(const wasm_extern_t *) 1914 * \brief Copies a #wasm_extern_t to a new one. 1915 * 1916 * The caller is responsible for deleting the returned #wasm_extern_t. 1917 * 1918 * \fn void wasm_extern_same(const wasm_extern_t *, const wasm_extern_t *) 1919 * \brief Unimplemented in Wasmtime, aborts the process if called. 1920 * 1921 * \fn void* wasm_extern_get_host_info(const wasm_extern_t *); 1922 * \brief Unimplemented in Wasmtime, always returns `NULL`. 1923 * 1924 * \fn void wasm_extern_set_host_info(wasm_extern_t *, void *); 1925 * \brief Unimplemented in Wasmtime, aborts the process if called. 1926 * 1927 * \fn void wasm_extern_set_host_info_with_finalizer(wasm_extern_t *, void *, void(*)(void*)); 1928 * \brief Unimplemented in Wasmtime, aborts the process if called. 1929 * 1930 * \fn wasm_ref_t *wasm_extern_as_ref(wasm_extern_t *); 1931 * \brief Unimplemented in Wasmtime, aborts the process if called. 1932 * 1933 * \fn wasm_extern_t *wasm_ref_as_extern(wasm_ref_t *); 1934 * \brief Unimplemented in Wasmtime, aborts the process if called. 1935 * 1936 * \fn const wasm_ref_t *wasm_extern_as_ref_const(const wasm_extern_t *); 1937 * \brief Unimplemented in Wasmtime, aborts the process if called. 1938 * 1939 * \fn const wasm_extern_t *wasm_ref_as_extern_const(const wasm_ref_t *); 1940 * \brief Unimplemented in Wasmtime, aborts the process if called. 1941 * 1942 * \fn wasm_ref_as_extern_const(const wasm_ref_t *); 1943 * \brief Unimplemented in Wasmtime, aborts the process if called. 1944 * 1945 * \fn wasm_externkind_t *wasm_extern_kind(const wasm_extern_t *); 1946 * \brief Returns the kind of this extern, indicating what it will downcast as. 1947 * 1948 * \fn wasm_externtype_t *wasm_extern_type(const wasm_extern_t *); 1949 * \brief Returns the type of this extern. 1950 * 1951 * The caller is expected to deallocate the returned #wasm_externtype_t. 1952 */ 1953 1954 /** 1955 * \fn wasm_extern_t *wasm_func_as_extern(wasm_func_t *f); 1956 * \brief Converts a #wasm_func_t to #wasm_extern_t. 1957 * 1958 * The returned #wasm_extern_t is owned by the #wasm_func_t argument. Callers 1959 * should not delete the returned value, and it only lives as long as the 1960 * #wasm_func_t argument. 1961 * 1962 * \fn wasm_extern_t *wasm_global_as_extern(wasm_global_t *f); 1963 * \brief Converts a #wasm_global_t to #wasm_extern_t. 1964 * 1965 * The returned #wasm_extern_t is owned by the #wasm_global_t argument. Callers 1966 * should not delete the returned value, and it only lives as long as the 1967 * #wasm_global_t argument. 1968 * 1969 * \fn wasm_extern_t *wasm_memory_as_extern(wasm_memory_t *f); 1970 * \brief Converts a #wasm_memory_t to #wasm_extern_t. 1971 * 1972 * The returned #wasm_extern_t is owned by the #wasm_memory_t argument. Callers 1973 * should not delete the returned value, and it only lives as long as the 1974 * #wasm_memory_t argument. 1975 * 1976 * \fn wasm_extern_t *wasm_table_as_extern(wasm_table_t *f); 1977 * \brief Converts a #wasm_table_t to #wasm_extern_t. 1978 * 1979 * The returned #wasm_extern_t is owned by the #wasm_table_t argument. Callers 1980 * should not delete the returned value, and it only lives as long as the 1981 * #wasm_table_t argument. 1982 * 1983 * \fn const wasm_extern_t *wasm_func_as_extern_const(const wasm_func_t *f); 1984 * \brief Converts a #wasm_func_t to #wasm_extern_t. 1985 * 1986 * The returned #wasm_extern_t is owned by the #wasm_func_t argument. Callers 1987 * should not delete the returned value, and it only lives as long as the 1988 * #wasm_func_t argument. 1989 * 1990 * \fn const wasm_extern_t *wasm_global_as_extern_const(const wasm_global_t *f); 1991 * \brief Converts a #wasm_global_t to #wasm_extern_t. 1992 * 1993 * The returned #wasm_extern_t is owned by the #wasm_global_t argument. Callers 1994 * should not delete the returned value, and it only lives as long as the 1995 * #wasm_global_t argument. 1996 * 1997 * \fn const wasm_extern_t *wasm_memory_as_extern_const(const wasm_memory_t *f); 1998 * \brief Converts a #wasm_memory_t to #wasm_extern_t. 1999 * 2000 * The returned #wasm_extern_t is owned by the #wasm_memory_t argument. Callers 2001 * should not delete the returned value, and it only lives as long as the 2002 * #wasm_memory_t argument. 2003 * 2004 * \fn const wasm_extern_t *wasm_table_as_extern_const(const wasm_table_t *f); 2005 * \brief Converts a #wasm_table_t to #wasm_extern_t. 2006 * 2007 * The returned #wasm_extern_t is owned by the #wasm_table_t argument. Callers 2008 * should not delete the returned value, and it only lives as long as the 2009 * #wasm_table_t argument. 2010 * 2011 * \fn wasm_func_t *wasm_extern_as_func(wasm_extern_t *); 2012 * \brief Converts a #wasm_extern_t to #wasm_func_t. 2013 * 2014 * The returned #wasm_func_t is owned by the #wasm_extern_t argument. Callers 2015 * should not delete the returned value, and it only lives as long as the 2016 * #wasm_extern_t argument. 2017 * 2018 * If the #wasm_extern_t argument isn't a #wasm_func_t then `NULL` is returned. 2019 * 2020 * \fn wasm_table_t *wasm_extern_as_table(wasm_extern_t *); 2021 * \brief Converts a #wasm_extern_t to #wasm_table_t. 2022 * 2023 * The returned #wasm_table_t is owned by the #wasm_extern_t argument. Callers 2024 * should not delete the returned value, and it only lives as long as the 2025 * #wasm_extern_t argument. 2026 * 2027 * If the #wasm_extern_t argument isn't a #wasm_table_t then `NULL` is returned. 2028 * 2029 * \fn wasm_memory_t *wasm_extern_as_memory(wasm_extern_t *); 2030 * \brief Converts a #wasm_extern_t to #wasm_memory_t. 2031 * 2032 * The returned #wasm_memory_t is owned by the #wasm_extern_t argument. Callers 2033 * should not delete the returned value, and it only lives as long as the 2034 * #wasm_extern_t argument. 2035 * 2036 * If the #wasm_extern_t argument isn't a #wasm_memory_t then `NULL` is returned. 2037 * 2038 * \fn wasm_global_t *wasm_extern_as_global(wasm_extern_t *); 2039 * \brief Converts a #wasm_extern_t to #wasm_global_t. 2040 * 2041 * The returned #wasm_global_t is owned by the #wasm_extern_t argument. Callers 2042 * should not delete the returned value, and it only lives as long as the 2043 * #wasm_extern_t argument. 2044 * 2045 * If the #wasm_extern_t argument isn't a #wasm_global_t then `NULL` is returned. 2046 * 2047 * \fn const wasm_func_t *wasm_extern_as_func_const(const wasm_extern_t *); 2048 * \brief Converts a #wasm_extern_t to #wasm_func_t. 2049 * 2050 * The returned #wasm_func_t is owned by the #wasm_extern_t argument. Callers 2051 * should not delete the returned value, and it only lives as long as the 2052 * #wasm_extern_t argument. 2053 * 2054 * If the #wasm_extern_t argument isn't a #wasm_func_t then `NULL` is returned. 2055 * 2056 * \fn const wasm_table_t *wasm_extern_as_table_const(const wasm_extern_t *); 2057 * \brief Converts a #wasm_extern_t to #wasm_table_t. 2058 * 2059 * The returned #wasm_table_t is owned by the #wasm_extern_t argument. Callers 2060 * should not delete the returned value, and it only lives as long as the 2061 * #wasm_extern_t argument. 2062 * 2063 * If the #wasm_extern_t argument isn't a #wasm_table_t then `NULL` is returned. 2064 * 2065 * \fn const wasm_memory_t *wasm_extern_as_memory_const(const wasm_extern_t *); 2066 * \brief Converts a #wasm_extern_t to #wasm_memory_t. 2067 * 2068 * The returned #wasm_memory_t is owned by the #wasm_extern_t argument. Callers 2069 * should not delete the returned value, and it only lives as long as the 2070 * #wasm_extern_t argument. 2071 * 2072 * If the #wasm_extern_t argument isn't a #wasm_memory_t then `NULL` is returned. 2073 * 2074 * \fn const wasm_global_t *wasm_extern_as_global_const(const wasm_extern_t *); 2075 * \brief Converts a #wasm_extern_t to #wasm_global_t. 2076 * 2077 * The returned #wasm_global_t is owned by the #wasm_extern_t argument. Callers 2078 * should not delete the returned value, and it only lives as long as the 2079 * #wasm_extern_t argument. 2080 * 2081 * If the #wasm_extern_t argument isn't a #wasm_global_t then `NULL` is returned. 2082 */ 2083 2084 /** 2085 * \struct wasm_instance_t 2086 * \brief Opaque struct representing a wasm instance. 2087 * 2088 * \typedef wasm_instance_t 2089 * \brief Convenience alias for #wasm_instance_t 2090 * 2091 * \fn void wasm_instance_delete(wasm_instance_t *v); 2092 * \brief Deletes a instance. 2093 * 2094 * \fn wasm_instance_t *wasm_instance_copy(const wasm_instance_t *) 2095 * \brief Copies a #wasm_instance_t to a new one. 2096 * 2097 * The caller is responsible for deleting the returned #wasm_instance_t. 2098 * 2099 * \fn void wasm_instance_same(const wasm_instance_t *, const wasm_instance_t *) 2100 * \brief Unimplemented in Wasmtime, aborts the process if called. 2101 * 2102 * \fn void* wasm_instance_get_host_info(const wasm_instance_t *); 2103 * \brief Unimplemented in Wasmtime, always returns `NULL`. 2104 * 2105 * \fn void wasm_instance_set_host_info(wasm_instance_t *, void *); 2106 * \brief Unimplemented in Wasmtime, aborts the process if called. 2107 * 2108 * \fn void wasm_instance_set_host_info_with_finalizer(wasm_instance_t *, void *, void(*)(void*)); 2109 * \brief Unimplemented in Wasmtime, aborts the process if called. 2110 * 2111 * \fn wasm_ref_t *wasm_instance_as_ref(wasm_instance_t *); 2112 * \brief Unimplemented in Wasmtime, aborts the process if called. 2113 * 2114 * \fn wasm_instance_t *wasm_ref_as_instance(wasm_ref_t *); 2115 * \brief Unimplemented in Wasmtime, aborts the process if called. 2116 * 2117 * \fn const wasm_ref_t *wasm_instance_as_ref_const(const wasm_instance_t *); 2118 * \brief Unimplemented in Wasmtime, aborts the process if called. 2119 * 2120 * \fn const wasm_instance_t *wasm_ref_as_instance_const(const wasm_ref_t *); 2121 * \brief Unimplemented in Wasmtime, aborts the process if called. 2122 * 2123 * \fn wasm_ref_as_instance_const(const wasm_ref_t *); 2124 * \brief Unimplemented in Wasmtime, aborts the process if called. 2125 * 2126 * \fn wasm_instance_t *wasm_instance_new(wasm_store_t *, const wasm_module_t *, const wasm_extern_vec_t *, wasm_trap_t **); 2127 * \brief Instantiates a module with the provided imports. 2128 * 2129 * This function will instantiate the provided #wasm_module_t into the provided 2130 * #wasm_store_t. The `imports` specified are used to satisfy the imports of the 2131 * #wasm_module_t. 2132 * 2133 * This function must provide exactly the same number of imports as returned by 2134 * #wasm_module_imports or this results in undefined behavior. 2135 * 2136 * Imports provided are expected to be 1:1 matches against the list returned by 2137 * #wasm_module_imports. 2138 * 2139 * Instantiation includes invoking the `start` function of a wasm module. If 2140 * that function traps then a trap is returned through the #wasm_trap_t type. 2141 * 2142 * This function does not take ownership of any of its arguments, and the 2143 * returned #wasm_instance_t and #wasm_trap_t are owned by the caller. 2144 * 2145 * \fn void wasm_instance_exports(const wasm_instance_t *, wasm_extern_vec_t *out); 2146 * \brief Returns the exports of an instance. 2147 * 2148 * This function returns a list of #wasm_extern_t values, which will be owned by 2149 * the caller, which are exported from the instance. The `out` list will have 2150 * the same length as #wasm_module_exports called on the original module. Each 2151 * element is 1:1 matched with the elements in the list of #wasm_module_exports. 2152 */ 2153 2154 /** 2155 * \def WASM_EMPTY_VEC 2156 * \brief Used to initialize an empty vector type. 2157 * 2158 * \def WASM_ARRAY_VEC 2159 * \brief Used to initialize a vector type from a C array. 2160 * 2161 * \def WASM_I32_VAL 2162 * \brief Used to initialize a 32-bit integer wasm_val_t value. 2163 * 2164 * \def WASM_I64_VAL 2165 * \brief Used to initialize a 64-bit integer wasm_val_t value. 2166 * 2167 * \def WASM_F32_VAL 2168 * \brief Used to initialize a 32-bit floating point wasm_val_t value. 2169 * 2170 * \def WASM_F64_VAL 2171 * \brief Used to initialize a 64-bit floating point wasm_val_t value. 2172 * 2173 * \def WASM_REF_VAL 2174 * \brief Used to initialize an externref wasm_val_t value. 2175 * 2176 * \def WASM_INIT_VAL 2177 * \brief Used to initialize a null externref wasm_val_t value. 2178 */ 2179