samples/native-lib: Add a bit more complicated example (#1643)

Add test_hello sample and update the document
This commit is contained in:
YAMAMOTO Takashi
2022-10-27 16:06:14 +09:00
committed by GitHub
parent 264fdfafed
commit bc58778c34
4 changed files with 56 additions and 2 deletions

View File

@ -49,14 +49,14 @@ will be generated.
```bash
cd build
./iwasm --native-lib=libtest_add.so --native-lib=libtest_sqrt.so wasm-app/test.wasm
./iwasm --native-lib=./libtest_add.so --native-lib=./libtest_sqrt.so --native-lib=./libtest_hello.so wasm-app/test.wasm
```
### macOS
```bash
cd build
./iwasm --native-lib=libtest_add.dylib --native-lib=libtest_sqrt.dylib wasm-app/test.wasm
./iwasm --native-lib=libtest_add.dylib --native-lib=libtest_sqrt.dylib --native-lib=libtest_hello.dylib wasm-app/test.wasm
```
The output is:
@ -65,4 +65,8 @@ The output is:
Hello World!
10 + 20 = 30
sqrt(10, 20) = 500
test_hello("main", 0x0, 0) = 41
malloc(42) = 0x24b8
test_hello("main", 0x24b8, 42) = 41
Message from test_hello: Hello, main. This is test_hello_wrapper!
```