lib-export.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright (C) 2019 Intel Corporation. All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef _LIB_EXPORT_H_
  17. #define _LIB_EXPORT_H_
  18. #ifdef __cplusplus
  19. extern "C" {
  20. #endif
  21. typedef struct NativeSymbol {
  22. const char *symbol;
  23. void *func_ptr;
  24. } NativeSymbol;
  25. #define EXPORT_WASM_API(symbol) {#symbol, symbol}
  26. #define EXPORT_WASM_API2(symbol) {#symbol, symbol##_wrapper}
  27. /**
  28. * Get the exported APIs of base lib
  29. *
  30. * @param p_base_lib_apis return the exported API array of base lib
  31. *
  32. * @return the number of the exported API
  33. */
  34. int
  35. get_base_lib_export_apis(NativeSymbol **p_base_lib_apis);
  36. /**
  37. * Get the exported APIs of extend lib
  38. *
  39. * @param p_base_lib_apis return the exported API array of extend lib
  40. *
  41. * @return the number of the exported API
  42. */
  43. int
  44. get_extend_lib_export_apis(NativeSymbol **p_base_lib_apis);
  45. #ifdef __cplusplus
  46. }
  47. #endif
  48. #endif