WAMR User APIs
lib_export.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 Intel Corporation. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
4  */
5 
12 #ifndef _LIB_EXPORT_H_
13 #define _LIB_EXPORT_H_
14 
15 #include <stdint.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 typedef struct NativeSymbol {
22  const char *symbol;
23  void *func_ptr;
24  const char *signature;
25  /* attachment which can be retrieved in native API by
26  calling wasm_runtime_get_function_attachment(exec_env) */
27  void *attachment;
28 } NativeSymbol;
29 
30 /* clang-format off */
31 #define EXPORT_WASM_API(symbol) \
32  { #symbol, (void *)symbol, NULL, NULL }
33 #define EXPORT_WASM_API2(symbol) \
34  { #symbol, (void *)symbol##_wrapper, NULL, NULL }
35 
36 #define EXPORT_WASM_API_WITH_SIG(symbol, signature) \
37  { #symbol, (void *)symbol, signature, NULL }
38 #define EXPORT_WASM_API_WITH_SIG2(symbol, signature) \
39  { #symbol, (void *)symbol##_wrapper, signature, NULL }
40 
41 #define EXPORT_WASM_API_WITH_ATT(symbol, signature, attachment) \
42  { #symbol, (void *)symbol, signature, attachment }
43 #define EXPORT_WASM_API_WITH_ATT2(symbol, signature, attachment) \
44  { #symbol, (void *)symbol##_wrapper, signature, attachment }
45 /* clang-format on */
46 
54 uint32_t
55 get_base_lib_export_apis(NativeSymbol **p_base_lib_apis);
56 
57 #ifdef __cplusplus
58 }
59 #endif
60 
61 #endif /* end of _LIB_EXPORT_H_ */
get_base_lib_export_apis
uint32_t get_base_lib_export_apis(NativeSymbol **p_base_lib_apis)
NativeSymbol
Definition: lib_export.h:21