wasm-native.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 _WASM_NATIVE_H
  17. #define _WASM_NATIVE_H
  18. #include "wasm.h"
  19. #ifdef __cplusplus
  20. extern "C" {
  21. #endif
  22. /**
  23. * Initialize the native module, e.g. sort the function defs
  24. * and the global defs.
  25. *
  26. * @return true if success, false otherwise
  27. */
  28. bool
  29. wasm_native_init();
  30. /**
  31. * Lookup native function implementation of a given import function.
  32. *
  33. * @param module_name the module name of the import function
  34. * @param func_name the function name of the import function
  35. *
  36. * @return return the native function pointer if success, NULL otherwise
  37. */
  38. void*
  39. wasm_native_func_lookup(const char *module_name, const char *func_name);
  40. /**
  41. * Lookup global variable of a given import global
  42. *
  43. * @param module_name the module name of the import global
  44. * @param global_name the global name of the import global
  45. * @param global return the global data
  46. *
  47. * @param return true if success, false otherwise
  48. */
  49. bool
  50. wasm_native_global_lookup(const char *module_name, const char *global_name,
  51. WASMGlobalImport *global);
  52. void* wasm_platform_native_func_lookup(const char *module_name,
  53. const char *func_name);
  54. #ifdef __cplusplus
  55. }
  56. #endif
  57. #endif /* end of _WASM_NATIVE_H */