test2.c 591 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #include <stdio.h>
  6. #include <stdint.h>
  7. extern void
  8. shared_heap_free(void *ptr);
  9. void
  10. print_buf(char *buf)
  11. {
  12. printf("wasm app2's wasm func received buf: %s\n\n", buf);
  13. shared_heap_free(buf);
  14. }
  15. void
  16. consume_str(char *buf)
  17. {
  18. /* Actually access it in wasm */
  19. char c = buf[0];
  20. printf("In WASM: wasm app2's wasm func received buf in pre-allocated "
  21. "shared buf: "
  22. "%s with its first char is %c\n\n",
  23. buf, c);
  24. }