gh-88267: Avoid DLL exporting functions from static builds on Windows(GH-99888)

This commit is contained in:
Christian Rendina 2022-12-09 12:16:15 +01:00 committed by GitHub
parent 748c6c0921
commit 3c5355496b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 3 deletions

View File

@ -2,9 +2,15 @@
#define Py_EXPORTS_H #define Py_EXPORTS_H
#if defined(_WIN32) || defined(__CYGWIN__) #if defined(_WIN32) || defined(__CYGWIN__)
#define Py_IMPORTED_SYMBOL __declspec(dllimport) #if defined(Py_ENABLE_SHARED)
#define Py_EXPORTED_SYMBOL __declspec(dllexport) #define Py_IMPORTED_SYMBOL __declspec(dllimport)
#define Py_LOCAL_SYMBOL #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 #else
/* /*
* If we only ever used gcc >= 5, we could use __has_attribute(visibility) * If we only ever used gcc >= 5, we could use __has_attribute(visibility)

View File

@ -0,0 +1 @@
Avoid exporting Python symbols in linked Windows applications when the core is built as static.