From f4f2d90d6a0c3bb3a61938af3f2e239fcd535c21 Mon Sep 17 00:00:00 2001 From: Kangping Date: Sat, 25 Feb 2023 02:52:39 +0800 Subject: [PATCH] Add missing dependencies to "openthread-posix" target (#8801) The `openthread-posix` library calls OT public APIs and library APIs (e.g. radio_spinel, HDLC), but it doesn't link against the library targets. This commit also adds `extern "C"` for posix impl of `otPlatFree` and `otPlatCAlloc`. --- src/posix/platform/CMakeLists.txt | 4 ++++ src/posix/platform/memory.cpp | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/posix/platform/CMakeLists.txt b/src/posix/platform/CMakeLists.txt index 28a5527a8..0a44c88a2 100644 --- a/src/posix/platform/CMakeLists.txt +++ b/src/posix/platform/CMakeLists.txt @@ -135,6 +135,10 @@ target_link_libraries(openthread-posix PUBLIC openthread-platform PRIVATE + openthread-cli-ftd + openthread-ftd + openthread-hdlc + openthread-spinel-rcp openthread-url ot-config-ftd ot-config diff --git a/src/posix/platform/memory.cpp b/src/posix/platform/memory.cpp index 7294dd6f2..15d4a799c 100644 --- a/src/posix/platform/memory.cpp +++ b/src/posix/platform/memory.cpp @@ -34,7 +34,9 @@ #include #if OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE +extern "C" { void *otPlatCAlloc(size_t aNum, size_t aSize) { return calloc(aNum, aSize); } void otPlatFree(void *aPtr) { free(aPtr); } +} // extern "C" #endif