summaryrefslogtreecommitdiffstats
path: root/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic
diff options
context:
space:
mode:
Diffstat (limited to 'fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic')
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/.gitignore1
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/CMakeLists.txt91
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/README.md51
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/build.sh63
-rwxr-xr-xfluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/run.sh3
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/src/main.c217
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/src/native_impl.c95
-rw-r--r--fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/wasm-apps/testapp.c90
8 files changed, 0 insertions, 611 deletions
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/.gitignore b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/.gitignore
deleted file mode 100644
index 0fa8a76bd..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/out/ \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/CMakeLists.txt b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/CMakeLists.txt
deleted file mode 100644
index 4191ad15d..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/CMakeLists.txt
+++ /dev/null
@@ -1,91 +0,0 @@
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-
-cmake_minimum_required (VERSION 3.14)
-
-include(CheckPIESupported)
-
-if (NOT WAMR_BUILD_PLATFORM STREQUAL "windows")
- project (basic)
-else()
- project (basic C ASM)
- enable_language (ASM_MASM)
-endif()
-
-################ runtime settings ################
-string (TOLOWER ${CMAKE_HOST_SYSTEM_NAME} WAMR_BUILD_PLATFORM)
-if (APPLE)
- add_definitions(-DBH_PLATFORM_DARWIN)
-endif ()
-
-# Reset default linker flags
-set (CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "")
-set (CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
-
-# WAMR features switch
-
-# Set WAMR_BUILD_TARGET, currently values supported:
-# "X86_64", "AMD_64", "X86_32", "AARCH64[sub]", "ARM[sub]", "THUMB[sub]",
-# "MIPS", "XTENSA", "RISCV64[sub]", "RISCV32[sub]"
-if (NOT DEFINED WAMR_BUILD_TARGET)
- if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)")
- set (WAMR_BUILD_TARGET "AARCH64")
- elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64")
- set (WAMR_BUILD_TARGET "RISCV64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 8)
- # Build as X86_64 by default in 64-bit platform
- set (WAMR_BUILD_TARGET "X86_64")
- elseif (CMAKE_SIZEOF_VOID_P EQUAL 4)
- # Build as X86_32 by default in 32-bit platform
- set (WAMR_BUILD_TARGET "X86_32")
- else ()
- message(SEND_ERROR "Unsupported build target platform!")
- endif ()
-endif ()
-
-if (NOT CMAKE_BUILD_TYPE)
- set (CMAKE_BUILD_TYPE Release)
-endif ()
-
-set (WAMR_BUILD_INTERP 1)
-set (WAMR_BUILD_AOT 1)
-set (WAMR_BUILD_JIT 0)
-set (WAMR_BUILD_LIBC_BUILTIN 1)
-
-if (NOT MSVC)
- set (WAMR_BUILD_LIBC_WASI 1)
-endif ()
-
-if (NOT MSVC)
- # linker flags
- if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
- set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections")
- endif ()
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wformat -Wformat-security")
- if (WAMR_BUILD_TARGET MATCHES "X86_.*" OR WAMR_BUILD_TARGET STREQUAL "AMD_64")
- if (NOT (CMAKE_C_COMPILER MATCHES ".*clang.*" OR CMAKE_C_COMPILER_ID MATCHES ".*Clang"))
- set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mindirect-branch-register")
- endif ()
- endif ()
-endif ()
-
-# build out vmlib
-set (WAMR_ROOT_DIR ${CMAKE_CURRENT_LIST_DIR}/../..)
-include (${WAMR_ROOT_DIR}/build-scripts/runtime_lib.cmake)
-
-add_library(vmlib ${WAMR_RUNTIME_LIB_SOURCE})
-
-################ application related ################
-include_directories(${CMAKE_CURRENT_LIST_DIR}/src)
-include (${SHARED_DIR}/utils/uncommon/shared_uncommon.cmake)
-
-add_executable (basic src/main.c src/native_impl.c ${UNCOMMON_SHARED_SOURCE})
-
-check_pie_supported()
-set_target_properties (basic PROPERTIES POSITION_INDEPENDENT_CODE ON)
-
-if (APPLE)
- target_link_libraries (basic vmlib -lm -ldl -lpthread)
-else ()
- target_link_libraries (basic vmlib -lm -ldl -lpthread -lrt)
-endif ()
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/README.md
deleted file mode 100644
index 32e7ed650..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/README.md
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-The "basic" sample project
-==============
-
-This sample demonstrates a few basic usages of embedding WAMR:
-- initialize runtime
-- load wasm app and instantiate the module
-- call wasm function and pass arguments
-- export native functions to the WASM apps
-- wasm function calls native function and pass arguments
-- deinitialize runtime
-
-Build this sample
-==============
-Execute the ```build.sh``` script then all binaries including wasm application files would be generated in 'out' directory.
-
-```
-$ ./build.sh
-```
-
-Run the sample
-==========================
-Enter the out directory.
-```
-$ cd ./out/
-$
-$ ./basic -f wasm-apps/testapp.wasm
-calling into WASM function: generate_float
-Native finished calling wasm function generate_float(), returned a float value: 102009.921875f
-calling into WASM function: float_to_string
-calling into native function: intToStr
-calling into native function: get_pow
-calling into native function: intToStr
-Native finished calling wasm function: float_to_string, returned a formatted string: 102009.921
-```
-Or execute the ```run.sh``` script in ```samples/basic``` folder.
-```
-$ ./run.sh
-calling into WASM function: generate_float
-Native finished calling wasm function generate_float(), returned a float value: 102009.921875f
-calling into WASM function: float_to_string
-calling into native function: intToStr
-calling into native function: get_pow
-calling into native function: intToStr
-Native finished calling wasm function: float_to_string, returned a formatted string: 102009.921
-```
-
-
-
-
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/build.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/build.sh
deleted file mode 100755
index a0be7e1c7..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/build.sh
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# Copyright (C) 2019 Intel Corporation. All rights reserved.
-# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-#
-
-#!/bin/bash
-
-CURR_DIR=$PWD
-WAMR_DIR=${PWD}/../..
-OUT_DIR=${PWD}/out
-
-WASM_APPS=${PWD}/wasm-apps
-
-
-rm -rf ${OUT_DIR}
-mkdir ${OUT_DIR}
-mkdir ${OUT_DIR}/wasm-apps
-
-
-echo "#####################build basic project"
-cd ${CURR_DIR}
-mkdir -p cmake_build
-cd cmake_build
-cmake ..
-make -j ${nproc}
-if [ $? != 0 ];then
- echo "BUILD_FAIL basic exit as $?\n"
- exit 2
-fi
-
-cp -a basic ${OUT_DIR}
-
-echo -e "\n"
-
-echo "#####################build wasm apps"
-
-cd ${WASM_APPS}
-
-for i in `ls *.c`
-do
-APP_SRC="$i"
-OUT_FILE=${i%.*}.wasm
-
-# use WAMR SDK to build out the .wasm binary
-/opt/wasi-sdk/bin/clang \
- --target=wasm32 -O0 -z stack-size=4096 -Wl,--initial-memory=65536 \
- --sysroot=${WAMR_DIR}/wamr-sdk/app/libc-builtin-sysroot \
- -Wl,--allow-undefined-file=${WAMR_DIR}/wamr-sdk/app/libc-builtin-sysroot/share/defined-symbols.txt \
- -Wl,--strip-all,--no-entry -nostdlib \
- -Wl,--export=generate_float \
- -Wl,--export=float_to_string \
- -Wl,--export=calculate\
- -Wl,--allow-undefined \
- -o ${OUT_DIR}/wasm-apps/${OUT_FILE} ${APP_SRC}
-
-
-if [ -f ${OUT_DIR}/wasm-apps/${OUT_FILE} ]; then
- echo "build ${OUT_FILE} success"
-else
- echo "build ${OUT_FILE} fail"
-fi
-done
-echo "####################build wasm apps done"
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/run.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/run.sh
deleted file mode 100755
index a5fb29166..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/run.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-out/basic -f out/wasm-apps/testapp.wasm \ No newline at end of file
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/src/main.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/src/main.c
deleted file mode 100644
index c35da3179..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/src/main.c
+++ /dev/null
@@ -1,217 +0,0 @@
-
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "wasm_export.h"
-#include "bh_read_file.h"
-#include "bh_getopt.h"
-
-int
-intToStr(int x, char *str, int str_len, int digit);
-int
-get_pow(int x, int y);
-int32_t
-calculate_native(int32_t n, int32_t func1, int32_t func2);
-
-void
-print_usage(void)
-{
- fprintf(stdout, "Options:\r\n");
- fprintf(stdout, " -f [path of wasm file] \n");
-}
-
-int
-main(int argc, char *argv_main[])
-{
- static char global_heap_buf[512 * 1024];
- char *buffer, error_buf[128];
- int opt;
- char *wasm_path = NULL;
-
- wasm_module_t module = NULL;
- wasm_module_inst_t module_inst = NULL;
- wasm_exec_env_t exec_env = NULL;
- uint32 buf_size, stack_size = 8092, heap_size = 8092;
- wasm_function_inst_t func = NULL;
- wasm_function_inst_t func2 = NULL;
- char *native_buffer = NULL;
- uint32_t wasm_buffer = 0;
-
- RuntimeInitArgs init_args;
- memset(&init_args, 0, sizeof(RuntimeInitArgs));
-
- while ((opt = getopt(argc, argv_main, "hf:")) != -1) {
- switch (opt) {
- case 'f':
- wasm_path = optarg;
- break;
- case 'h':
- print_usage();
- return 0;
- case '?':
- print_usage();
- return 0;
- }
- }
- if (optind == 1) {
- print_usage();
- return 0;
- }
-
- // Define an array of NativeSymbol for the APIs to be exported.
- // Note: the array must be static defined since runtime
- // will keep it after registration
- // For the function signature specifications, goto the link:
- // https://github.com/bytecodealliance/wasm-micro-runtime/blob/main/doc/export_native_api.md
-
- static NativeSymbol native_symbols[] = {
- {
- "intToStr", // the name of WASM function name
- intToStr, // the native function pointer
- "(i*~i)i", // the function prototype signature, avoid to use i32
- NULL // attachment is NULL
- },
- {
- "get_pow", // the name of WASM function name
- get_pow, // the native function pointer
- "(ii)i", // the function prototype signature, avoid to use i32
- NULL // attachment is NULL
- },
- { "calculate_native", calculate_native, "(iii)i", NULL }
- };
-
- init_args.mem_alloc_type = Alloc_With_Pool;
- init_args.mem_alloc_option.pool.heap_buf = global_heap_buf;
- init_args.mem_alloc_option.pool.heap_size = sizeof(global_heap_buf);
-
- // Native symbols need below registration phase
- init_args.n_native_symbols = sizeof(native_symbols) / sizeof(NativeSymbol);
- init_args.native_module_name = "env";
- init_args.native_symbols = native_symbols;
-
- if (!wasm_runtime_full_init(&init_args)) {
- printf("Init runtime environment failed.\n");
- return -1;
- }
-
- buffer = bh_read_file_to_buffer(wasm_path, &buf_size);
-
- if (!buffer) {
- printf("Open wasm app file [%s] failed.\n", wasm_path);
- goto fail;
- }
-
- module = wasm_runtime_load(buffer, buf_size, error_buf, sizeof(error_buf));
- if (!module) {
- printf("Load wasm module failed. error: %s\n", error_buf);
- goto fail;
- }
-
- module_inst = wasm_runtime_instantiate(module, stack_size, heap_size,
- error_buf, sizeof(error_buf));
-
- if (!module_inst) {
- printf("Instantiate wasm module failed. error: %s\n", error_buf);
- goto fail;
- }
-
- exec_env = wasm_runtime_create_exec_env(module_inst, stack_size);
- if (!exec_env) {
- printf("Create wasm execution environment failed.\n");
- goto fail;
- }
-
- if (!(func = wasm_runtime_lookup_function(module_inst, "generate_float",
- NULL))) {
- printf("The generate_float wasm function is not found.\n");
- goto fail;
- }
-
- wasm_val_t results[1] = { { .kind = WASM_F32, .of.f32 = 0 } };
- wasm_val_t arguments[3] = {
- { .kind = WASM_I32, .of.i32 = 10 },
- { .kind = WASM_F64, .of.f64 = 0.000101 },
- { .kind = WASM_F32, .of.f32 = 300.002 },
- };
-
- // pass 4 elements for function arguments
- if (!wasm_runtime_call_wasm_a(exec_env, func, 1, results, 3, arguments)) {
- printf("call wasm function generate_float failed. %s\n",
- wasm_runtime_get_exception(module_inst));
- goto fail;
- }
-
- float ret_val;
- ret_val = results[0].of.f32;
- printf("Native finished calling wasm function generate_float(), returned a "
- "float value: %ff\n",
- ret_val);
-
- // Next we will pass a buffer to the WASM function
- uint32 argv2[4];
-
- // must allocate buffer from wasm instance memory space (never use pointer
- // from host runtime)
- wasm_buffer =
- wasm_runtime_module_malloc(module_inst, 100, (void **)&native_buffer);
-
- memcpy(argv2, &ret_val, sizeof(float)); // the first argument
- argv2[1] = wasm_buffer; // the second argument is the wasm buffer address
- argv2[2] = 100; // the third argument is the wasm buffer size
- argv2[3] = 3; // the last argument is the digits after decimal point for
- // converting float to string
-
- if (!(func2 = wasm_runtime_lookup_function(module_inst, "float_to_string",
- NULL))) {
- printf(
- "The wasm function float_to_string wasm function is not found.\n");
- goto fail;
- }
-
- if (wasm_runtime_call_wasm(exec_env, func2, 4, argv2)) {
- printf("Native finished calling wasm function: float_to_string, "
- "returned a formatted string: %s\n",
- native_buffer);
- }
- else {
- printf("call wasm function float_to_string failed. error: %s\n",
- wasm_runtime_get_exception(module_inst));
- goto fail;
- }
-
- wasm_function_inst_t func3 =
- wasm_runtime_lookup_function(module_inst, "calculate", NULL);
- if (!func3) {
- printf("The wasm function calculate is not found.\n");
- goto fail;
- }
-
- uint32_t argv3[1] = { 3 };
- if (wasm_runtime_call_wasm(exec_env, func3, 1, argv3)) {
- uint32_t result = *(uint32_t *)argv3;
- printf("Native finished calling wasm function: calculate, return: %d\n",
- result);
- }
- else {
- printf("call wasm function calculate failed. error: %s\n",
- wasm_runtime_get_exception(module_inst));
- goto fail;
- }
-
-fail:
- if (exec_env)
- wasm_runtime_destroy_exec_env(exec_env);
- if (module_inst) {
- if (wasm_buffer)
- wasm_runtime_module_free(module_inst, wasm_buffer);
- wasm_runtime_deinstantiate(module_inst);
- }
- if (module)
- wasm_runtime_unload(module);
- if (buffer)
- BH_FREE(buffer);
- wasm_runtime_destroy();
- return 0;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/src/native_impl.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/src/native_impl.c
deleted file mode 100644
index 1374c8dd8..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/src/native_impl.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include "bh_platform.h"
-#include "wasm_export.h"
-#include "math.h"
-
-// The first parameter is not exec_env because it is invoked by native funtions
-void
-reverse(char *str, int len)
-{
- int i = 0, j = len - 1, temp;
- while (i < j) {
- temp = str[i];
- str[i] = str[j];
- str[j] = temp;
- i++;
- j--;
- }
-}
-
-// The first parameter exec_env must be defined using type wasm_exec_env_t
-// which is the calling convention for exporting native API by WAMR.
-//
-// Converts a given integer x to string str[].
-// digit is the number of digits required in the output.
-// If digit is more than the number of digits in x,
-// then 0s are added at the beginning.
-int
-intToStr(wasm_exec_env_t exec_env, int x, char *str, int str_len, int digit)
-{
- int i = 0;
-
- printf("calling into native function: %s\n", __FUNCTION__);
-
- while (x) {
- // native is responsible for checking the str_len overflow
- if (i >= str_len) {
- return -1;
- }
- str[i++] = (x % 10) + '0';
- x = x / 10;
- }
-
- // If number of digits required is more, then
- // add 0s at the beginning
- while (i < digit) {
- if (i >= str_len) {
- return -1;
- }
- str[i++] = '0';
- }
-
- reverse(str, i);
-
- if (i >= str_len)
- return -1;
- str[i] = '\0';
- return i;
-}
-
-int
-get_pow(wasm_exec_env_t exec_env, int x, int y)
-{
- printf("calling into native function: %s\n", __FUNCTION__);
- return (int)pow(x, y);
-}
-
-int32_t
-calculate_native(wasm_exec_env_t exec_env, int32_t n, int32_t func1,
- int32_t func2)
-{
- printf("calling into native function: %s, n=%d, func1=%d, func2=%d\n",
- __FUNCTION__, n, func1, func2);
-
- uint32_t argv[] = { n };
- if (!wasm_runtime_call_indirect(exec_env, func1, 1, argv)) {
- printf("call func1 failed\n");
- return 0xDEAD;
- }
-
- uint32_t n1 = argv[0];
- printf("call func1 and return n1=%d\n", n1);
-
- if (!wasm_runtime_call_indirect(exec_env, func2, 1, argv)) {
- printf("call func2 failed\n");
- return 0xDEAD;
- }
-
- uint32_t n2 = argv[0];
- printf("call func2 and return n2=%d\n", n2);
- return n1 + n2;
-}
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/wasm-apps/testapp.c b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/wasm-apps/testapp.c
deleted file mode 100644
index ea575e20c..000000000
--- a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/samples/basic/wasm-apps/testapp.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2019 Intel Corporation. All rights reserved.
- * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdint.h>
-
-int
-intToStr(int x, char *str, int str_len, int digit);
-int
-get_pow(int x, int y);
-int32_t
-calculate_native(int32_t n, int32_t func1, int32_t func2);
-
-//
-// Primitive parameters functions
-//
-float
-generate_float(int iteration, double seed1, float seed2)
-{
- float ret;
-
- printf("calling into WASM function: %s\n", __FUNCTION__);
-
- for (int i = 0; i < iteration; i++) {
- ret += 1.0f / seed1 + seed2;
- }
-
- return ret;
-}
-
-// Converts a floating-point/double number to a string.
-// intToStr() is implemented outside wasm app
-void
-float_to_string(float n, char *res, int res_size, int afterpoint)
-{
-
- printf("calling into WASM function: %s\n", __FUNCTION__);
-
- // Extract integer part
- int ipart = (int)n;
-
- // Extract floating part
- float fpart = n - (float)ipart;
-
- // convert integer part to string
- int i = intToStr(ipart, res, res_size, 0);
-
- // check for display option after point
- if (afterpoint != 0) {
- res[i] = '.'; // add dot
-
- // Get the value of fraction part upto given no.
- // of points after dot. The third parameter
- // is needed to handle cases like 233.007
- fpart = fpart * get_pow(10, afterpoint);
-
- intToStr((int)fpart, res + i + 1, sizeof(res + i + 1), afterpoint);
- }
-}
-
-int32_t
-mul7(int32_t n)
-{
- printf("calling into WASM function: %s,", __FUNCTION__);
- n = n * 7;
- printf(" %s return %d \n", __FUNCTION__, n);
- return n;
-}
-
-int32_t
-mul5(int32_t n)
-{
- printf("calling into WASM function: %s,", __FUNCTION__);
- n = n * 5;
- printf(" %s return %d \n", __FUNCTION__, n);
- return n;
-}
-
-int32_t
-calculate(int32_t n)
-{
- printf("calling into WASM function: %s\n", __FUNCTION__);
- int32_t (*f1)(int32_t) = &mul5;
- int32_t (*f2)(int32_t) = &mul7;
- return calculate_native(n, (uint32_t)f1, (uint32_t)f2);
-}