python (3.12.0)
1 #ifndef Py_EXPORTS_H
2 #define Py_EXPORTS_H
3
4 #if defined(_WIN32) || defined(__CYGWIN__)
5 #if defined(Py_ENABLE_SHARED)
6 #define Py_IMPORTED_SYMBOL __declspec(dllimport)
7 #define Py_EXPORTED_SYMBOL __declspec(dllexport)
8 #define Py_LOCAL_SYMBOL
9 #else
10 #define Py_IMPORTED_SYMBOL
11 #define Py_EXPORTED_SYMBOL
12 #define Py_LOCAL_SYMBOL
13 #endif
14 #else
15 /*
16 * If we only ever used gcc >= 5, we could use __has_attribute(visibility)
17 * as a cross-platform way to determine if visibility is supported. However,
18 * we may still need to support gcc >= 4, as some Ubuntu LTS and Centos versions
19 * have 4 < gcc < 5.
20 */
21 #ifndef __has_attribute
22 #define __has_attribute(x) 0 // Compatibility with non-clang compilers.
23 #endif
24 #if (defined(__GNUC__) && (__GNUC__ >= 4)) ||\
25 (defined(__clang__) && __has_attribute(visibility))
26 #define Py_IMPORTED_SYMBOL __attribute__ ((visibility ("default")))
27 #define Py_EXPORTED_SYMBOL __attribute__ ((visibility ("default")))
28 #define Py_LOCAL_SYMBOL __attribute__ ((visibility ("hidden")))
29 #else
30 #define Py_IMPORTED_SYMBOL
31 #define Py_EXPORTED_SYMBOL
32 #define Py_LOCAL_SYMBOL
33 #endif
34 #endif
35
36 #endif /* Py_EXPORTS_H */