exports.h 1.1 KB

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