main.c 889 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #include <stdlib.h>
  6. #include <string.h>
  7. #include "bh_platform.h"
  8. #include "wasm_export.h"
  9. static char global_heap_buf[10 * 1024 * 1024] = { 0 };
  10. void
  11. test_invoke_native();
  12. int
  13. main(int argc, char *argv[])
  14. {
  15. RuntimeInitArgs init_args;
  16. memset(&init_args, 0, sizeof(RuntimeInitArgs));
  17. init_args.mem_alloc_type = Alloc_With_Pool;
  18. init_args.mem_alloc_option.pool.heap_buf = global_heap_buf;
  19. init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
  20. /* initialize runtime environment */
  21. if (!wasm_runtime_full_init(&init_args)) {
  22. printf("Init runtime environment failed.\n");
  23. return -1;
  24. }
  25. test_invoke_native();
  26. /* destroy runtime environment */
  27. wasm_runtime_destroy();
  28. return 0;
  29. }