visibility.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* Gearman server and library
  2. * Copyright (C) 2008 Brian Aker, Eric Day
  3. * All rights reserved.
  4. *
  5. * Use and distribution licensed under the BSD license. See
  6. * the COPYING file in this directory for full text.
  7. *
  8. * Implementation drawn from visibility.texi in gnulib.
  9. */
  10. /**
  11. * @file
  12. * @brief Visibility Control Macros
  13. */
  14. #ifndef __GEARMAN_VISIBILITY_H
  15. #define __GEARMAN_VISIBILITY_H
  16. /**
  17. * GEARMAN_API is used for the public API symbols. It either DLL imports or
  18. * DLL exports (or does nothing for static build).
  19. *
  20. * GEARMAN_LOCAL is used for non-api symbols.
  21. */
  22. #if defined(BUILDING_LIBGEARMAN)
  23. # if defined(HAVE_VISIBILITY)
  24. # define GEARMAN_API __attribute__ ((visibility("default")))
  25. # define GEARMAN_INTERNAL_API __attribute__ ((visibility("hidden")))
  26. # define GEARMAN_API_DEPRECATED __attribute__ ((deprecated,visibility("default")))
  27. # define GEARMAN_LOCAL __attribute__ ((visibility("hidden")))
  28. # elif defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
  29. # define GEARMAN_API __global
  30. # define GEARMAN_INTERNAL_API __hidden
  31. # define GEARMAN_API_DEPRECATED __global
  32. # define GEARMAN_LOCAL __hidden
  33. # elif defined(_MSC_VER)
  34. # define GEARMAN_API extern __declspec(dllexport)
  35. # define GEARMAN_INTERNAL_API extern __declspec(dllexport)
  36. # define GEARMAN_DEPRECATED_API extern __declspec(dllexport)
  37. # define GEARMAN_LOCAL
  38. # endif /* defined(HAVE_VISIBILITY) */
  39. #else /* defined(BUILDING_LIBGEARMAN) */
  40. # if defined(_MSC_VER)
  41. # define GEARMAN_API extern __declspec(dllimport)
  42. # define GEARMAN_INTERNAL_API extern __declspec(dllimport)
  43. # define GEARMAN_API_DEPRECATED extern __declspec(dllimport)
  44. # define GEARMAN_LOCAL
  45. # else
  46. # define GEARMAN_API
  47. # define GEARMAN_INTERNAL_API
  48. # define GEARMAN_API_DEPRECATED
  49. # define GEARMAN_LOCAL
  50. # endif /* defined(_MSC_VER) */
  51. #endif /* defined(BUILDING_LIBGEARMAN) */
  52. #endif /* __GEARMAN_VISIBILITY_H */