Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

Fix the onnxfrontend didn't call DLLMain when exit (#33641)

liangd9065773e58e
diff --git a/src/frontends/common/shutdown_protobuf/CMakeLists.txt b/src/frontends/common/shutdown_protobuf/CMakeLists.txt
index 0667bbe5b9b..d0c945ed45b 100644
--- a/src/frontends/common/shutdown_protobuf/CMakeLists.txt
+++ b/src/frontends/common/shutdown_protobuf/CMakeLists.txt
@@ -4,7 +4,8 @@
set(TARGET_NAME openvino_protobuf_shutdown)
-add_library(${TARGET_NAME} STATIC shutdown_protobuf.cpp)
+# Use OBJECT instead of STATIC to ensure DLLMain is invoked when the shared library is unloaded
+add_library(${TARGET_NAME} OBJECT shutdown_protobuf.cpp)
add_library(openvino::protobuf_shutdown ALIAS ${TARGET_NAME})
set_target_properties(${TARGET_NAME} PROPERTIES EXPORT_NAME protobuf_shutdown)