Example 2: Using "native-lib"
The related code/working directory of this example resides in directory {WAMR_DIR}/samples/native-lib
This sample demonstrates how to write required interfaces in native library, build it into a shared library and register the shared library to iwasm.
The native library should provide get_native_lib
API for iwasm to return the native library info, including the module name, the native symbol list and the native symbol count, so that iwasm can use them to regiter the native library, for example:
Preparation
Build the sample
iwasm
, one wasm module test.wasm
and two shared libraries libtest_add.so
, libtest_sqrt.so
will be generated.
Run workload
Linux
macOS
The output is:
Last updated