From a91601613071ea163ef1780e41e287f48eb3c47c Mon Sep 17 00:00:00 2001 From: wangchuanxia Date: Mon, 11 Mar 2024 17:06:43 +0800 Subject: [PATCH] nncore not dlopen nnrt_ext Signed-off-by: wangchuanxia --- .../native/neural_network_core/backend_manager.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/frameworks/native/neural_network_core/backend_manager.h b/frameworks/native/neural_network_core/backend_manager.h index 5e25e87..2f6297c 100644 --- a/frameworks/native/neural_network_core/backend_manager.h +++ b/frameworks/native/neural_network_core/backend_manager.h @@ -41,11 +41,15 @@ public: static BackendManager& GetInstance() { - if (dlopen("libneural_network_runtime_ext.so", RTLD_NOLOAD) == nullptr) { - LOGI("dlopen libneural_network_runtime_ext.so."); - void* libHandle = dlopen("libneural_network_runtime_ext.so", RTLD_NOW | RTLD_GLOBAL); - if (libHandle == nullptr) { - LOGW("Failed to dlopen libneural_network_runtime_ext.so."); + // if libneural_network_runtime.so loaded + if (dlopen("libneural_network_runtime.so", RTLD_NOLOAD) != nullptr) { + // if libneural_network_runtime_ext.so not loaded, try to dlopen it + if (dlopen("libneural_network_runtime_ext.so", RTLD_NOLOAD) == nullptr) { + LOGI("dlopen libneural_network_runtime_ext.so."); + void* libHandle = dlopen("libneural_network_runtime_ext.so", RTLD_NOW | RTLD_GLOBAL); + if (libHandle == nullptr) { + LOGW("Failed to dlopen libneural_network_runtime_ext.so."); + } } } static BackendManager instance; -- Gitee