wasm_application.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright (C) 2019 Taobao (China) Inc. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef _WASM_APPLICATION_H
  6. #define _WASM_APPLICATION_H
  7. //#include "wasm_runtime.h"
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. struct WASMModuleInstance;
  12. /**
  13. * Find the unique main function from a WASM module instance
  14. * and execute that function.
  15. *
  16. * @param module_inst the WASM module instance
  17. * @param argc the number of arguments
  18. * @param argv the arguments array
  19. *
  20. * @return true if the main function is called, false otherwise and exception will be thrown,
  21. * the caller can call wasm_runtime_get_exception to get exception info.
  22. */
  23. bool
  24. wasm_application_execute_main(struct WASMModuleInstance *module_inst,
  25. int argc, char *argv[]);
  26. /**
  27. * Find the specified function in argv[0] from a WASM module instance
  28. * and execute that function.
  29. *
  30. * @param module_inst the WASM module instance
  31. * @param name the name of the function to execute
  32. * @param argc the number of arguments
  33. * @param argv the arguments array
  34. *
  35. * @return true if the specified function is called, false otherwise and exception will be thrown,
  36. * the caller can call wasm_runtime_get_exception to get exception info.
  37. */
  38. bool
  39. wasm_application_execute_func(struct WASMModuleInstance *module_inst,
  40. char *name, int argc, char *argv[]);
  41. #ifdef __cplusplus
  42. }
  43. #endif
  44. #endif /* end of _WASM_APPLICATION_H */