From 1e22d1a9e545f6efc8d793bdbe6d75165b62adf4 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Fri, 7 Oct 2022 16:17:36 +0900 Subject: [PATCH] Fix the "register native with iwasm" stuff for macOS (#1558) - core/shared/platform/darwin/platform_internal.h: macOS has dlopen - samples/native-lib/README.md: Mention macOS --- core/shared/platform/darwin/platform_internal.h | 2 ++ samples/native-lib/README.md | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/core/shared/platform/darwin/platform_internal.h b/core/shared/platform/darwin/platform_internal.h index d46d6a930..284e376e7 100644 --- a/core/shared/platform/darwin/platform_internal.h +++ b/core/shared/platform/darwin/platform_internal.h @@ -46,6 +46,8 @@ extern "C" { #define BH_PLATFORM_DARWIN #endif +#define BH_HAS_DLFCN 1 + /* Stack size of applet threads's native part. */ #define BH_APPLET_PRESERVED_STACK_SIZE (32 * 1024) diff --git a/samples/native-lib/README.md b/samples/native-lib/README.md index ae052b932..797469bfe 100644 --- a/samples/native-lib/README.md +++ b/samples/native-lib/README.md @@ -45,11 +45,20 @@ will be generated. ## Run workload +### Linux + ```bash cd build ./iwasm --native-lib=libtest_add.so --native-lib=libtest_sqrt.so wasm-app/test.wasm ``` +### macOS + +```bash +cd build +./iwasm --native-lib=libtest_add.dylib --native-lib=libtest_sqrt.dylib wasm-app/test.wasm +``` + The output is: ```bash