visibility.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* visibility.h
  2. *
  3. * Copyright (C) 2006-2020 wolfSSL Inc.
  4. *
  5. * This file is part of wolfSSL.
  6. *
  7. * wolfSSL is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * wolfSSL is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  20. */
  21. /* Visibility control macros */
  22. #ifndef WOLF_CRYPT_VISIBILITY_H
  23. #define WOLF_CRYPT_VISIBILITY_H
  24. /* for compatibility and so that fips is using same name of macro @wc_fips */
  25. /* The following visibility wrappers are for old FIPS. New FIPS should use
  26. * the same as a non-FIPS build. */
  27. #if defined(HAVE_FIPS) && \
  28. (!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))
  29. #include <cyassl/ctaocrypt/visibility.h>
  30. #define WOLFSSL_API CYASSL_API
  31. #define WOLFSSL_LOCAL CYASSL_LOCAL
  32. #else
  33. /* WOLFSSL_API is used for the public API symbols.
  34. It either imports or exports (or does nothing for static builds)
  35. WOLFSSL_LOCAL is used for non-API symbols (private).
  36. */
  37. #if defined(BUILDING_WOLFSSL)
  38. #if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) || \
  39. defined(_WIN32_WCE)
  40. #if defined(WOLFSSL_DLL)
  41. #define WOLFSSL_API __declspec(dllexport)
  42. #else
  43. #define WOLFSSL_API
  44. #endif
  45. #define WOLFSSL_LOCAL
  46. #elif defined(HAVE_VISIBILITY) && HAVE_VISIBILITY
  47. #define WOLFSSL_API __attribute__ ((visibility("default")))
  48. #define WOLFSSL_LOCAL __attribute__ ((visibility("hidden")))
  49. #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
  50. #define WOLFSSL_API __global
  51. #define WOLFSSL_LOCAL __hidden
  52. #else
  53. #define WOLFSSL_API
  54. #define WOLFSSL_LOCAL
  55. #endif /* HAVE_VISIBILITY */
  56. #else /* BUILDING_WOLFSSL */
  57. #if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) || \
  58. defined(_WIN32_WCE)
  59. #if defined(WOLFSSL_DLL)
  60. #define WOLFSSL_API __declspec(dllimport)
  61. #else
  62. #define WOLFSSL_API
  63. #endif
  64. #define WOLFSSL_LOCAL
  65. #else
  66. #define WOLFSSL_API
  67. #define WOLFSSL_LOCAL
  68. #endif
  69. #endif /* BUILDING_WOLFSSL */
  70. #endif /* HAVE_FIPS */
  71. #endif /* WOLF_CRYPT_VISIBILITY_H */