wasm_export.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef _WASM_EXPORT_H
  6. #define _WASM_EXPORT_H
  7. #include <stdint.h>
  8. #include <stdbool.h>
  9. #include "lib_export.h"
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. #define get_module_inst(exec_env) \
  14. wasm_runtime_get_module_inst(exec_env)
  15. #define validate_app_addr(offset, size) \
  16. wasm_runtime_validate_app_addr(module_inst, offset, size)
  17. #define validate_app_str_addr(offset) \
  18. wasm_runtime_validate_app_str_addr(module_inst, offset)
  19. #define addr_app_to_native(offset) \
  20. wasm_runtime_addr_app_to_native(module_inst, offset)
  21. #define addr_native_to_app(ptr) \
  22. wasm_runtime_addr_native_to_app(module_inst, ptr)
  23. #define module_malloc(size, p_native_addr) \
  24. wasm_runtime_module_malloc(module_inst, size, p_native_addr)
  25. #define module_free(offset) \
  26. wasm_runtime_module_free(module_inst, offset)
  27. #define native_raw_return_type(type, args) type *raw_ret = (type*)(args)
  28. #define native_raw_get_arg(type, name, args) type name = *((type*)(args++))
  29. #define native_raw_set_return(val) *raw_ret = (val)
  30. /* Uninstantiated WASM module loaded from WASM binary file
  31. or AoT binary file*/
  32. struct WASMModuleCommon;
  33. typedef struct WASMModuleCommon *wasm_module_t;
  34. /* Instantiated WASM module */
  35. struct WASMModuleInstanceCommon;
  36. typedef struct WASMModuleInstanceCommon *wasm_module_inst_t;
  37. /* Function instance */
  38. typedef void WASMFunctionInstanceCommon;
  39. typedef WASMFunctionInstanceCommon *wasm_function_inst_t;
  40. /* WASM section */
  41. typedef struct wasm_section_t {
  42. struct wasm_section_t *next;
  43. /* section type */
  44. int section_type;
  45. /* section body, not include type and size */
  46. uint8_t *section_body;
  47. /* section body size */
  48. uint32_t section_body_size;
  49. } wasm_section_t, aot_section_t, *wasm_section_list_t, *aot_section_list_t;
  50. /* Execution environment, e.g. stack info */
  51. struct WASMExecEnv;
  52. typedef struct WASMExecEnv *wasm_exec_env_t;
  53. /* Package Type */
  54. typedef enum {
  55. Wasm_Module_Bytecode = 0,
  56. Wasm_Module_AoT,
  57. Package_Type_Unknown = 0xFFFF
  58. } package_type_t;
  59. /* Memory allocator type */
  60. typedef enum {
  61. /* pool mode, allocate memory from user defined heap buffer */
  62. Alloc_With_Pool = 0,
  63. /* user allocator mode, allocate memory from user defined
  64. malloc function */
  65. Alloc_With_Allocator,
  66. /* system allocator mode, allocate memory from system allocator,
  67. or, platform's os_malloc function */
  68. Alloc_With_System_Allocator,
  69. } mem_alloc_type_t;
  70. /* Memory allocator option */
  71. typedef union MemAllocOption {
  72. struct {
  73. void *heap_buf;
  74. uint32_t heap_size;
  75. } pool;
  76. struct {
  77. void *malloc_func;
  78. void *realloc_func;
  79. void *free_func;
  80. } allocator;
  81. } MemAllocOption;
  82. /* WASM runtime initialize arguments */
  83. typedef struct RuntimeInitArgs {
  84. mem_alloc_type_t mem_alloc_type;
  85. MemAllocOption mem_alloc_option;
  86. const char *native_module_name;
  87. NativeSymbol *native_symbols;
  88. uint32_t n_native_symbols;
  89. } RuntimeInitArgs;
  90. /**
  91. * Initialize the WASM runtime environment, and also initialize
  92. * the memory allocator with system allocator, which calls os_malloc
  93. * to allocate memory
  94. *
  95. * @return true if success, false otherwise
  96. */
  97. bool
  98. wasm_runtime_init();
  99. /**
  100. * Initialize the WASM runtime environment, and also initialize
  101. * the memory allocator and register native symbols, which are specified
  102. * with init arguments
  103. *
  104. * @param init_args specifies the init arguments
  105. *
  106. * @return return true if success, false otherwise
  107. */
  108. bool
  109. wasm_runtime_full_init(RuntimeInitArgs *init_args);
  110. /**
  111. * Destroy the WASM runtime environment.
  112. */
  113. void
  114. wasm_runtime_destroy();
  115. /**
  116. * Allocate memory from runtime memory environment.
  117. *
  118. * @param size bytes need to allocate
  119. *
  120. * @return the pointer to memory allocated
  121. */
  122. void *
  123. wasm_runtime_malloc(unsigned int size);
  124. /**
  125. * Reallocate memory from runtime memory environment
  126. *
  127. * @param ptr the original memory
  128. * @param size bytes need to reallocate
  129. *
  130. * @return the pointer to memory reallocated
  131. */
  132. void *
  133. wasm_runtime_realloc(void *ptr, unsigned int size);
  134. /*
  135. * Free memory to runtime memory environment.
  136. */
  137. void wasm_runtime_free(void *ptr);
  138. /**
  139. * Get the package type of a buffer.
  140. *
  141. * @param buf the package buffer
  142. * @param size the package buffer size
  143. *
  144. * @return the package type, return Package_Type_Unknown if the type is unknown
  145. */
  146. package_type_t
  147. get_package_type(const uint8_t *buf, uint32_t size);
  148. #if WASM_ENABLE_MULTI_MODULE != 0
  149. /**
  150. * It is a callback for WAMR providing by embedding to load a module file
  151. * into a buffer
  152. */
  153. typedef bool (*module_reader)(const char *module_name,
  154. uint8_t **p_buffer, uint32_t *p_size);
  155. /**
  156. * It is a callback for WAMR providing by embedding to release the buffer which
  157. * is used by loading a module file
  158. */
  159. typedef void (*module_destroyer)(uint8_t *buffer, uint32_t size);
  160. /**
  161. * To setup callbacks for reading and releasing a buffer about a module file
  162. *
  163. * @param reader a callback to read a module file into a buffer
  164. * @param destroyer a callback to release above buffer
  165. */
  166. void
  167. wasm_runtime_set_module_reader(const module_reader reader,
  168. const module_destroyer destroyer);
  169. /**
  170. * Give the "module" a name "module_name".
  171. * can not assign a new name to a module if it already has a name
  172. *
  173. * @param module_name indicate a name
  174. * @param module the target module
  175. * @param error_buf output of the exception info
  176. * @param error_buf_size the size of the exception string
  177. *
  178. * @return true means success, false means failed
  179. */
  180. bool
  181. wasm_runtime_register_module(const char *module_name, wasm_module_t module,
  182. char *error_buf, uint32_t error_buf_size);
  183. /**
  184. * To check if there is already a loaded module named module_name in the
  185. * runtime. you will not want to load repeately
  186. *
  187. * @param module_name indicate a name
  188. *
  189. * @return return WASM module loaded, NULL if failed
  190. */
  191. wasm_module_t
  192. wasm_runtime_find_module_registered(const char *module_name);
  193. #endif /* WASM_ENABLE_MULTI_MODULE */
  194. /**
  195. * Load a WASM module from a specified byte buffer. The byte buffer can be
  196. * WASM binary data when interpreter or JIT is enabled, or AOT binary data
  197. * when AOT is enabled. If it is AOT binary data, it must be 4-byte aligned.
  198. *
  199. * @param buf the byte buffer which contains the WASM binary data
  200. * @param size the size of the buffer
  201. * @param error_buf output of the exception info
  202. * @param error_buf_size the size of the exception string
  203. *
  204. * @return return WASM module loaded, NULL if failed
  205. */
  206. wasm_module_t
  207. wasm_runtime_load(const uint8_t *buf, uint32_t size,
  208. char *error_buf, uint32_t error_buf_size);
  209. /**
  210. * Load a WASM module from a specified WASM or AOT section list.
  211. *
  212. * @param section_list the section list which contains each section data
  213. * @param is_aot whether the section list is AOT section list
  214. * @param error_buf output of the exception info
  215. * @param error_buf_size the size of the exception string
  216. *
  217. * @return return WASM module loaded, NULL if failed
  218. */
  219. wasm_module_t
  220. wasm_runtime_load_from_sections(wasm_section_list_t section_list, bool is_aot,
  221. char *error_buf, uint32_t error_buf_size);
  222. /**
  223. * Unload a WASM module.
  224. *
  225. * @param module the module to be unloaded
  226. */
  227. void
  228. wasm_runtime_unload(wasm_module_t module);
  229. void
  230. wasm_runtime_set_wasi_args(wasm_module_t module,
  231. const char *dir_list[], uint32_t dir_count,
  232. const char *map_dir_list[], uint32_t map_dir_count,
  233. const char *env[], uint32_t env_count,
  234. char *argv[], int argc);
  235. /**
  236. * Instantiate a WASM module.
  237. *
  238. * @param module the WASM module to instantiate
  239. * @param stack_size the default stack size of the module instance when the
  240. * exec env's operation stack isn't created by user, e.g. API
  241. * wasm_application_execute_main() and wasm_application_execute_func()
  242. * create the operation stack internally with the stack size specified
  243. * here. And API wasm_runtime_create_exec_env() creates the operation
  244. * stack with stack size specified by its parameter, the stack size
  245. * specified here is ignored.
  246. * @param heap_size the default heap size of the module instance, a heap will
  247. * be created besides the app memory space. Both wasm app and native
  248. * function can allocate memory from the heap. If heap_size is 0, the
  249. * default heap size will be used.
  250. * @param error_buf buffer to output the error info if failed
  251. * @param error_buf_size the size of the error buffer
  252. *
  253. * @return return the instantiated WASM module instance, NULL if failed
  254. */
  255. wasm_module_inst_t
  256. wasm_runtime_instantiate(const wasm_module_t module,
  257. uint32_t stack_size, uint32_t heap_size,
  258. char *error_buf, uint32_t error_buf_size);
  259. /**
  260. * Deinstantiate a WASM module instance, destroy the resources.
  261. *
  262. * @param module_inst the WASM module instance to destroy
  263. */
  264. void
  265. wasm_runtime_deinstantiate(wasm_module_inst_t module_inst);
  266. bool
  267. wasm_runtime_is_wasi_mode(wasm_module_inst_t module_inst);
  268. wasm_function_inst_t
  269. wasm_runtime_lookup_wasi_start_function(wasm_module_inst_t module_inst);
  270. /**
  271. * Lookup an exported function in the WASM module instance.
  272. *
  273. * @param module_inst the module instance
  274. * @param name the name of the function
  275. * @param signature the signature of the function, ignored currently
  276. *
  277. * @return the function instance found
  278. */
  279. wasm_function_inst_t
  280. wasm_runtime_lookup_function(wasm_module_inst_t const module_inst,
  281. const char *name, const char *signature);
  282. /**
  283. * Create execution environment for a WASM module instance.
  284. *
  285. * @param module_inst the module instance
  286. * @param stack_size the stack size to execute a WASM function
  287. *
  288. * @return the execution environment
  289. */
  290. wasm_exec_env_t
  291. wasm_runtime_create_exec_env(wasm_module_inst_t module_inst,
  292. uint32_t stack_size);
  293. /**
  294. * Destroy the execution environment.
  295. *
  296. * @param exec_env the execution environment to destroy
  297. */
  298. void
  299. wasm_runtime_destroy_exec_env(wasm_exec_env_t exec_env);
  300. /**
  301. * Get WASM module instance from execution environment
  302. *
  303. * @param exec_env the execution environment to retrieve
  304. *
  305. * @return the WASM module instance
  306. */
  307. wasm_module_inst_t
  308. wasm_runtime_get_module_inst(wasm_exec_env_t exec_env);
  309. /**
  310. * Call the given WASM function of a WASM module instance with
  311. * arguments (bytecode and AoT).
  312. *
  313. * @param exec_env the execution environment to call the function,
  314. * which must be created from wasm_create_exec_env()
  315. * @param function the function to call
  316. * @param argc the number of arguments
  317. * @param argv the arguments. If the function has return value,
  318. * the first (or first two in case 64-bit return value) element of
  319. * argv stores the return value of the called WASM function after this
  320. * function returns.
  321. *
  322. * @return true if success, false otherwise and exception will be thrown,
  323. * the caller can call wasm_runtime_get_exception to get the exception
  324. * info.
  325. */
  326. bool
  327. wasm_runtime_call_wasm(wasm_exec_env_t exec_env,
  328. wasm_function_inst_t function,
  329. uint32_t argc, uint32_t argv[]);
  330. /**
  331. * Find the unique main function from a WASM module instance
  332. * and execute that function.
  333. *
  334. * @param module_inst the WASM module instance
  335. * @param argc the number of arguments
  336. * @param argv the arguments array
  337. *
  338. * @return true if the main function is called, false otherwise and exception
  339. * will be thrown, the caller can call wasm_runtime_get_exception to get
  340. * the exception info.
  341. */
  342. bool
  343. wasm_application_execute_main(wasm_module_inst_t module_inst,
  344. int32_t argc, char *argv[]);
  345. /**
  346. * Find the specified function in argv[0] from a WASM module instance
  347. * and execute that function.
  348. *
  349. * @param module_inst the WASM module instance
  350. * @param name the name of the function to execute.
  351. * to indicate the module name via: $module_name$function_name
  352. * or just a function name: function_name
  353. * @param argc the number of arguments
  354. * @param argv the arguments array
  355. *
  356. * @return true if the specified function is called, false otherwise and
  357. * exception will be thrown, the caller can call wasm_runtime_get_exception
  358. * to get the exception info.
  359. */
  360. bool
  361. wasm_application_execute_func(wasm_module_inst_t module_inst,
  362. const char *name, int32_t argc, char *argv[]);
  363. /**
  364. * Get exception info of the WASM module instance.
  365. *
  366. * @param module_inst the WASM module instance
  367. *
  368. * @return the exception string
  369. */
  370. const char *
  371. wasm_runtime_get_exception(wasm_module_inst_t module_inst);
  372. /**
  373. * Set exception info of the WASM module instance.
  374. *
  375. * @param module_inst the WASM module instance
  376. *
  377. * @param exception the exception string
  378. */
  379. void
  380. wasm_runtime_set_exception(wasm_module_inst_t module_inst,
  381. const char *exception);
  382. /**
  383. * Clear exception info of the WASM module instance.
  384. *
  385. * @param module_inst the WASM module instance
  386. */
  387. void
  388. wasm_runtime_clear_exception(wasm_module_inst_t module_inst);
  389. /**
  390. * Set custom data to WASM module instance.
  391. *
  392. * @param module_inst the WASM module instance
  393. * @param custom_data the custom data to be set
  394. */
  395. void
  396. wasm_runtime_set_custom_data(wasm_module_inst_t module_inst,
  397. void *custom_data);
  398. /**
  399. * Get the custom data within a WASM module instance.
  400. *
  401. * @param module_inst the WASM module instance
  402. *
  403. * @return the custom data (NULL if not set yet)
  404. */
  405. void *
  406. wasm_runtime_get_custom_data(wasm_module_inst_t module_inst);
  407. /**
  408. * Allocate memory from the heap of WASM module instance
  409. *
  410. * @param module_inst the WASM module instance which contains heap
  411. * @param size the size bytes to allocate
  412. * @param p_native_addr return native address of the allocated memory
  413. * if it is not NULL, and return NULL if memory malloc failed
  414. *
  415. * @return the allocated memory address, which is a relative offset to the
  416. * base address of the module instance's memory space, the value range
  417. * is (-heap_size, 0). Note that it is not an absolute address.
  418. * Return non-zero if success, zero if failed.
  419. */
  420. int32_t
  421. wasm_runtime_module_malloc(wasm_module_inst_t module_inst, uint32_t size,
  422. void **p_native_addr);
  423. /**
  424. * Free memory to the heap of WASM module instance
  425. *
  426. * @param module_inst the WASM module instance which contains heap
  427. * @param ptr the pointer to free
  428. */
  429. void
  430. wasm_runtime_module_free(wasm_module_inst_t module_inst, int32_t ptr);
  431. /**
  432. * Allocate memory from the heap of WASM module instance and initialize
  433. * the memory with src
  434. *
  435. * @param module_inst the WASM module instance which contains heap
  436. * @param src the source data to copy
  437. * @param size the size of the source data
  438. *
  439. * @return the allocated memory address, which is a relative offset to the
  440. * base address of the module instance's memory space, the value range
  441. * is (-heap_size, 0). Note that it is not an absolute address.
  442. * Return non-zero if success, zero if failed.
  443. */
  444. int32_t
  445. wasm_runtime_module_dup_data(wasm_module_inst_t module_inst,
  446. const char *src, uint32_t size);
  447. /**
  448. * Validate the app address, check whether it belongs to WASM module
  449. * instance's address space, or in its heap space or memory space.
  450. *
  451. * @param module_inst the WASM module instance
  452. * @param app_offset the app address to validate, which is a relative address
  453. * @param size the size bytes of the app address
  454. *
  455. * @return true if success, false otherwise. If failed, an exception will
  456. * be thrown.
  457. */
  458. bool
  459. wasm_runtime_validate_app_addr(wasm_module_inst_t module_inst,
  460. int32_t app_offset, uint32_t size);
  461. /**
  462. * Similar to wasm_runtime_validate_app_addr(), except that the size parameter
  463. * is not provided. This function validates the app string address, check whether it
  464. * belongs to WASM module instance's address space, or in its heap space or
  465. * memory space. Moreover, it checks whether it is the offset of a string that
  466. * is end with '\0'.
  467. * @param module_inst the WASM module instance
  468. * @param app_str_offset the app address of the string to validate, which is a
  469. * relative address
  470. *
  471. * @return true if success, false otherwise. If failed, an exception will
  472. * be thrown.
  473. */
  474. bool
  475. wasm_runtime_validate_app_str_addr(wasm_module_inst_t module_inst,
  476. int32_t app_str_offset);
  477. /**
  478. * Validate the native address, check whether it belongs to WASM module
  479. * instance's address space, or in its heap space or memory space.
  480. *
  481. * @param module_inst the WASM module instance
  482. * @param native_ptr the native address to validate, which is an absolute
  483. * address
  484. * @param size the size bytes of the app address
  485. *
  486. * @return true if success, false otherwise. If failed, an exception will
  487. * be thrown.
  488. */
  489. bool
  490. wasm_runtime_validate_native_addr(wasm_module_inst_t module_inst,
  491. void *native_ptr, uint32_t size);
  492. /**
  493. * Convert app address(relative address) to native address(absolute address)
  494. *
  495. * @param module_inst the WASM module instance
  496. * @param app_offset the app adress
  497. *
  498. * @return the native address converted
  499. */
  500. void*
  501. wasm_runtime_addr_app_to_native(wasm_module_inst_t module_inst,
  502. int32_t app_offset);
  503. /**
  504. * Convert native address(absolute address) to app address(relative address)
  505. *
  506. * @param module_inst the WASM module instance
  507. * @param native_ptr the native address
  508. *
  509. * @return the app address converted
  510. */
  511. int32_t
  512. wasm_runtime_addr_native_to_app(wasm_module_inst_t module_inst,
  513. void *native_ptr);
  514. /**
  515. * Get the app address range (relative address) that a app address belongs to
  516. *
  517. * @param module_inst the WASM module instance
  518. * @param app_offset the app address to retrieve
  519. * @param p_app_start_offset buffer to output the app start offset if not NULL
  520. * @param p_app_end_offset buffer to output the app end offset if not NULL
  521. *
  522. * @return true if success, false otherwise.
  523. */
  524. bool
  525. wasm_runtime_get_app_addr_range(wasm_module_inst_t module_inst,
  526. int32_t app_offset,
  527. int32_t *p_app_start_offset,
  528. int32_t *p_app_end_offset);
  529. /**
  530. * Get the native address range (absolute address) that a native address belongs to
  531. *
  532. * @param module_inst the WASM module instance
  533. * @param native_ptr the native address to retrieve
  534. * @param p_native_start_addr buffer to output the native start address if not NULL
  535. * @param p_native_end_addr buffer to output the native end address if not NULL
  536. *
  537. * @return true if success, false otherwise.
  538. */
  539. bool
  540. wasm_runtime_get_native_addr_range(wasm_module_inst_t module_inst,
  541. uint8_t *native_ptr,
  542. uint8_t **p_native_start_addr,
  543. uint8_t **p_native_end_addr);
  544. /**
  545. * Register native functions with same module name
  546. *
  547. * @param module_name the module name of the native functions
  548. * @param native_symbols specifies an array of NativeSymbol structures which
  549. * contain the names, function pointers and signatures
  550. * Note: WASM runtime will not allocate memory to clone the data, so
  551. * user must ensure the array can be used forever
  552. * Meanings of letters in function signature:
  553. * 'i': the parameter is i32 type
  554. * 'I': the parameter is i64 type
  555. * 'f': the parameter is f32 type
  556. * 'F': the parameter is f64 type
  557. * '*': the parameter is a pointer (i32 in WASM), and runtime will
  558. * auto check its boundary before calling the native function.
  559. * If it is followed by '~', the checked length of the pointer
  560. * is gotten from the following parameter, if not, the checked
  561. * length of the pointer is 1.
  562. * '~': the parameter is the pointer's length with i32 type, and must
  563. * follow after '*'
  564. * '$': the parameter is a string (i32 in WASM), and runtime will
  565. * auto check its boundary before calling the native function
  566. * @param n_native_symbols specifies the number of native symbols in the array
  567. *
  568. * @return true if success, false otherwise
  569. */
  570. bool wasm_runtime_register_natives(const char *module_name,
  571. NativeSymbol *native_symbols,
  572. uint32_t n_native_symbols);
  573. /**
  574. * Register native functions with same module name, similar to
  575. * wasm_runtime_register_natives, the difference is that runtime passes raw
  576. * arguments to native API, which means that the native API should be defined as:
  577. * void foo(wasm_exec_env_t exec_env, uint64 *args);
  578. * and native API should extract arguments one by one from args array with macro
  579. * native_raw_get_arg
  580. * and write the return value back to args[0] with macro
  581. * native_raw_return_type and native_raw_set_return
  582. */
  583. bool wasm_runtime_register_natives_raw(const char *module_name,
  584. NativeSymbol *native_symbols,
  585. uint32_t n_native_symbols);
  586. /**
  587. * Get attachment of native function from execution environment
  588. *
  589. * @param exec_env the execution environment to retrieve
  590. *
  591. * @return the attachment of native function
  592. */
  593. void *
  594. wasm_runtime_get_function_attachment(wasm_exec_env_t exec_env);
  595. /**
  596. * Set user data to execution environment.
  597. *
  598. * @param exec_env the execution environment
  599. * @param user_data the user data to be set
  600. */
  601. void
  602. wasm_runtime_set_user_data(wasm_exec_env_t exec_env,
  603. void *user_data);
  604. /**
  605. * Get the user data within execution environment.
  606. *
  607. * @param exec_env the execution environment
  608. *
  609. * @return the user data (NULL if not set yet)
  610. */
  611. void *
  612. wasm_runtime_get_user_data(wasm_exec_env_t exec_env);
  613. #ifdef __cplusplus
  614. }
  615. #endif
  616. #endif /* end of _WASM_EXPORT_H */