From: Christian Rendina Date: Fri, 9 Dec 2022 11:16:15 +0000 (+0100) Subject: gh-88267: Avoid DLL exporting functions from static builds on Windows(GH-99888) X-Git-Tag: v3.12.0a4~252 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3c5355496b54fa0a4ea0e22344d008528e45682c;p=thirdparty%2FPython%2Fcpython.git gh-88267: Avoid DLL exporting functions from static builds on Windows(GH-99888) --- diff --git a/Include/exports.h b/Include/exports.h index fc1a5c5ead62..59373c39ff75 100644 --- a/Include/exports.h +++ b/Include/exports.h @@ -2,9 +2,15 @@ #define Py_EXPORTS_H #if defined(_WIN32) || defined(__CYGWIN__) - #define Py_IMPORTED_SYMBOL __declspec(dllimport) - #define Py_EXPORTED_SYMBOL __declspec(dllexport) - #define Py_LOCAL_SYMBOL + #if defined(Py_ENABLE_SHARED) + #define Py_IMPORTED_SYMBOL __declspec(dllimport) + #define Py_EXPORTED_SYMBOL __declspec(dllexport) + #define Py_LOCAL_SYMBOL + #else + #define Py_IMPORTED_SYMBOL + #define Py_EXPORTED_SYMBOL + #define Py_LOCAL_SYMBOL + #endif #else /* * If we only ever used gcc >= 5, we could use __has_attribute(visibility) diff --git a/Misc/NEWS.d/next/Build/2022-12-08-14-00-04.gh-issue-88267.MqtRbm.rst b/Misc/NEWS.d/next/Build/2022-12-08-14-00-04.gh-issue-88267.MqtRbm.rst new file mode 100644 index 000000000000..29c3f5a1d763 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2022-12-08-14-00-04.gh-issue-88267.MqtRbm.rst @@ -0,0 +1 @@ +Avoid exporting Python symbols in linked Windows applications when the core is built as static.