native_impl.c 410 B

123456789101112131415
  1. /*
  2. * Copyright (C) 2023 Midokura Japan KK. All rights reserved.
  3. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. */
  5. #include "wasm_export.h"
  6. #include "my_context.h"
  7. int32_t
  8. add_native(wasm_exec_env_t exec_env, int32_t n)
  9. {
  10. wasm_module_inst_t inst = wasm_runtime_get_module_inst(exec_env);
  11. struct my_context *ctx = wasm_runtime_get_context(inst, my_context_key);
  12. return n + ctx->x;
  13. }