Where Online Learning is simpler!
The C and C++ Include Header Files
cat -n /usr/include/python3.14/exports.h
1 #ifndef Py_EXPORTS_H 2 #define Py_EXPORTS_H 3 4 /* Declarations for symbol visibility. 5 6 PyAPI_FUNC(type): Declares a public Python API function and return type 7 PyAPI_DATA(type): Declares public Python data and its type 8 PyMODINIT_FUNC: A Python module init function. If these functions are 9 inside the Python core, they are private to the core. 10 If in an extension module, it may be declared with 11 external linkage depending on the platform. 12 13 As a number of platforms support/require "__declspec(dllimport/dllexport)", 14 we support a HAVE_DECLSPEC_DLL macro to save duplication. 15 */ 16 17 /* 18 All windows ports, except cygwin, are handled in PC/pyconfig.h. 19 20 Cygwin is the only other autoconf platform requiring special 21 linkage handling and it uses __declspec(). 22 */ 23 #if defined(__CYGWIN__) 24 # define HAVE_DECLSPEC_DLL 25 #endif 26 27 #if defined(_WIN32) || defined(__CYGWIN__) 28 #if defined(Py_ENABLE_SHARED) 29 #define Py_IMPORTED_SYMBOL __declspec(dllimport) 30 #define Py_EXPORTED_SYMBOL __declspec(dllexport) 31 #define Py_LOCAL_SYMBOL 32 #else 33 #define Py_IMPORTED_SYMBOL 34 #define Py_EXPORTED_SYMBOL 35 #define Py_LOCAL_SYMBOL 36 #endif 37 #else 38 /* 39 * If we only ever used gcc >= 5, we could use __has_attribute(visibility) 40 * as a cross-platform way to determine if visibility is supported. However, 41 * we may still need to support gcc >= 4, as some Ubuntu LTS and Centos versions 42 * have 4 < gcc < 5. 43 */ 44 #if (defined(__GNUC__) && (__GNUC__ >= 4)) ||\ 45 (defined(__clang__) && _Py__has_attribute(visibility)) 46 #define Py_IMPORTED_SYMBOL __attribute__ ((visibility ("default"))) 47 #define Py_EXPORTED_SYMBOL __attribute__ ((visibility ("default"))) 48 #define Py_LOCAL_SYMBOL __attribute__ ((visibility ("hidden"))) 49 #else 50 #define Py_IMPORTED_SYMBOL 51 #define Py_EXPORTED_SYMBOL 52 #define Py_LOCAL_SYMBOL 53 #endif 54 #endif 55 56 /* only get special linkage if built as shared or platform is Cygwin */ 57 #if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__) 58 # if defined(HAVE_DECLSPEC_DLL) 59 # if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE) 60 # define PyAPI_FUNC(RTYPE) Py_EXPORTED_SYMBOL RTYPE 61 # define PyAPI_DATA(RTYPE) extern Py_EXPORTED_SYMBOL RTYPE 62 /* module init functions inside the core need no external linkage */ 63 /* except for Cygwin to handle embedding */ 64 # if defined(__CYGWIN__) 65 # define PyMODINIT_FUNC Py_EXPORTED_SYMBOL PyObject* 66 # else /* __CYGWIN__ */ 67 # define PyMODINIT_FUNC PyObject* 68 # endif /* __CYGWIN__ */ 69 # else /* Py_BUILD_CORE */ 70 /* Building an extension module, or an embedded situation */ 71 /* public Python functions and data are imported */ 72 /* Under Cygwin, auto-import functions to prevent compilation */ 73 /* failures similar to those described at the bottom of 4.1: */ 74 /* http://docs.python.org/extending/windows.html#a-cookbook-approach */ 75 # if !defined(__CYGWIN__) 76 # define PyAPI_FUNC(RTYPE) Py_IMPORTED_SYMBOL RTYPE 77 # endif /* !__CYGWIN__ */ 78 # define PyAPI_DATA(RTYPE) extern Py_IMPORTED_SYMBOL RTYPE 79 /* module init functions outside the core must be exported */ 80 # if defined(__cplusplus) 81 # define PyMODINIT_FUNC extern "C" Py_EXPORTED_SYMBOL PyObject* 82 # else /* __cplusplus */ 83 # define PyMODINIT_FUNC Py_EXPORTED_SYMBOL PyObject* 84 # endif /* __cplusplus */ 85 # endif /* Py_BUILD_CORE */ 86 # endif /* HAVE_DECLSPEC_DLL */ 87 #endif /* Py_ENABLE_SHARED */ 88 89 /* If no external linkage macros defined by now, create defaults */ 90 #ifndef PyAPI_FUNC 91 # define PyAPI_FUNC(RTYPE) Py_EXPORTED_SYMBOL RTYPE 92 #endif 93 #ifndef PyAPI_DATA 94 # define PyAPI_DATA(RTYPE) extern Py_EXPORTED_SYMBOL RTYPE 95 #endif 96 #ifndef PyMODINIT_FUNC 97 # if defined(__cplusplus) 98 # define PyMODINIT_FUNC extern "C" Py_EXPORTED_SYMBOL PyObject* 99 # else /* __cplusplus */ 100 # define PyMODINIT_FUNC Py_EXPORTED_SYMBOL PyObject* 101 # endif /* __cplusplus */ 102 #endif 103 104 105 #endif /* Py_EXPORTS_H */