|
35 | 35 | #define Py_EXPORTED_SYMBOL |
36 | 36 | #define Py_LOCAL_SYMBOL |
37 | 37 | #endif |
| 38 | + /* module init functions outside the core must be exported */ |
| 39 | + #if defined(Py_BUILD_CORE) |
| 40 | + #define _PyINIT_EXPORTED_SYMBOL Py_EXPORTED_SYMBOL |
| 41 | + #else |
| 42 | + #define _PyINIT_EXPORTED_SYMBOL __declspec(dllexport) |
| 43 | + #endif |
38 | 44 | #else |
39 | 45 | /* |
40 | 46 | * If we only ever used gcc >= 5, we could use __has_attribute(visibility) |
|
52 | 58 | #define Py_EXPORTED_SYMBOL |
53 | 59 | #define Py_LOCAL_SYMBOL |
54 | 60 | #endif |
| 61 | + #define _PyINIT_EXPORTED_SYMBOL Py_EXPORTED_SYMBOL |
55 | 62 | #endif |
56 | 63 |
|
57 | 64 | /* only get special linkage if built as shared or platform is Cygwin */ |
58 | 65 | #if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__) |
59 | 66 | # if defined(HAVE_DECLSPEC_DLL) |
60 | 67 | # if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) |
61 | | -# define PyAPI_FUNC(RTYPE) Py_EXPORTED_SYMBOL RTYPE |
62 | | -# define PyAPI_DATA(RTYPE) extern Py_EXPORTED_SYMBOL RTYPE |
63 | 68 | /* module init functions inside the core need no external linkage */ |
64 | 69 | /* except for Cygwin to handle embedding */ |
65 | | -# if defined(__CYGWIN__) |
66 | | -# define _PyINIT_FUNC_DECLSPEC Py_EXPORTED_SYMBOL |
67 | | -# else /* __CYGWIN__ */ |
| 70 | +# if !defined(__CYGWIN__) |
68 | 71 | # define _PyINIT_FUNC_DECLSPEC |
69 | 72 | # endif /* __CYGWIN__ */ |
70 | 73 | # else /* Py_BUILD_CORE */ |
|
77 | 80 | # define PyAPI_FUNC(RTYPE) Py_IMPORTED_SYMBOL RTYPE |
78 | 81 | # endif /* !__CYGWIN__ */ |
79 | 82 | # define PyAPI_DATA(RTYPE) extern Py_IMPORTED_SYMBOL RTYPE |
80 | | - /* module init functions outside the core must be exported */ |
81 | | -# if defined(__cplusplus) |
82 | | -# define _PyINIT_FUNC_DECLSPEC extern "C" Py_EXPORTED_SYMBOL |
83 | | -# else /* __cplusplus */ |
84 | | -# define _PyINIT_FUNC_DECLSPEC Py_EXPORTED_SYMBOL |
85 | | -# endif /* __cplusplus */ |
86 | 83 | # endif /* Py_BUILD_CORE */ |
87 | 84 | # endif /* HAVE_DECLSPEC_DLL */ |
88 | 85 | #endif /* Py_ENABLE_SHARED */ |
|
96 | 93 | #endif |
97 | 94 | #ifndef _PyINIT_FUNC_DECLSPEC |
98 | 95 | # if defined(__cplusplus) |
99 | | -# define _PyINIT_FUNC_DECLSPEC extern "C" Py_EXPORTED_SYMBOL |
| 96 | +# define _PyINIT_FUNC_DECLSPEC extern "C" _PyINIT_EXPORTED_SYMBOL |
100 | 97 | # else /* __cplusplus */ |
101 | | -# define _PyINIT_FUNC_DECLSPEC Py_EXPORTED_SYMBOL |
| 98 | +# define _PyINIT_FUNC_DECLSPEC _PyINIT_EXPORTED_SYMBOL |
102 | 99 | # endif /* __cplusplus */ |
103 | 100 | #endif |
104 | 101 |
|
105 | | -#define PyMODINIT_FUNC _PyINIT_FUNC_DECLSPEC PyObject* |
106 | | -#define PyMODEXPORT_FUNC _PyINIT_FUNC_DECLSPEC PyModuleDef_Slot* |
| 102 | +#ifndef PyMODINIT_FUNC |
| 103 | + #define PyMODINIT_FUNC _PyINIT_FUNC_DECLSPEC PyObject* |
| 104 | +#endif |
| 105 | +#ifndef PyMODEXPORT_FUNC |
| 106 | + #define PyMODEXPORT_FUNC _PyINIT_FUNC_DECLSPEC PyModuleDef_Slot* |
| 107 | +#endif |
107 | 108 |
|
108 | 109 | #endif /* Py_EXPORTS_H */ |
0 commit comments