lib_export.h 1021 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #ifndef _LIB_EXPORT_H_
  6. #define _LIB_EXPORT_H_
  7. #include <inttypes.h>
  8. #ifdef __cplusplus
  9. extern "C" {
  10. #endif
  11. typedef struct NativeSymbol {
  12. const char *symbol;
  13. void *func_ptr;
  14. const char *signature;
  15. } NativeSymbol;
  16. #define EXPORT_WASM_API(symbol) {#symbol, (void*)symbol, NULL}
  17. #define EXPORT_WASM_API2(symbol) {#symbol, (void*)symbol##_wrapper, NULL}
  18. #define EXPORT_WASM_API_WITH_SIG(symbol, signature) \
  19. {#symbol, (void*)symbol, signature}
  20. #define EXPORT_WASM_API_WITH_SIG2(symbol, signature) \
  21. {#symbol, (void*)symbol##_wrapper, signature}
  22. /**
  23. * Get the exported APIs of base lib
  24. *
  25. * @param p_base_lib_apis return the exported API array of base lib
  26. *
  27. * @return the number of the exported API
  28. */
  29. uint32_t
  30. get_base_lib_export_apis(NativeSymbol **p_base_lib_apis);
  31. #ifdef __cplusplus
  32. }
  33. #endif
  34. #endif