From d12490f6614ca0ccf43a73fd938144aa5f1b4e8b Mon Sep 17 00:00:00 2001 From: Zhao Yuhang <2546789017@qq.com> Date: Fri, 5 Apr 2024 23:33:12 +0800 Subject: [PATCH] QtCore: avoid unnecessary export in static build We only need it to be exported in shared builds. Without this change, there will always be an exported symbol called "qt_startup_hook" for executables that linked against QtCore statically, this is absolutely not the Qt user would expect. Change-Id: Icf19df09531e13184ea019aa708d6b93fa626f85 Reviewed-by: Thiago Macieira --- src/corelib/kernel/qcoreapplication.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 2244f976a4b..939965cff74 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -241,7 +241,11 @@ void QCoreApplicationPrivate::processCommandLineArguments() // Support for introspection -extern "C" void Q_DECL_EXPORT_OVERRIDABLE qt_startup_hook() +extern "C" void +#ifdef QT_SHARED +Q_DECL_EXPORT_OVERRIDABLE +#endif +qt_startup_hook() { }