visibility.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /* visibility.h
  2. *
  3. * Copyright (C) 2006-2023 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. /* WOLFSSL_API is used for the public API symbols.
  25. It either imports or exports (or does nothing for static builds)
  26. WOLFSSL_LOCAL is used for non-API symbols (private).
  27. */
  28. #if defined(BUILDING_WOLFSSL)
  29. #if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) || \
  30. defined(_WIN32_WCE)
  31. #if defined(WOLFSSL_DLL)
  32. #define WOLFSSL_API __declspec(dllexport)
  33. #else
  34. #define WOLFSSL_API
  35. #endif
  36. #define WOLFSSL_LOCAL
  37. #elif defined(HAVE_VISIBILITY) && HAVE_VISIBILITY
  38. #define WOLFSSL_API __attribute__ ((visibility("default")))
  39. #define WOLFSSL_LOCAL __attribute__ ((visibility("hidden")))
  40. #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
  41. #define WOLFSSL_API __global
  42. #define WOLFSSL_LOCAL __hidden
  43. #else
  44. #define WOLFSSL_API
  45. #define WOLFSSL_LOCAL
  46. #endif /* HAVE_VISIBILITY */
  47. #else /* BUILDING_WOLFSSL */
  48. #if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) || \
  49. defined(_WIN32_WCE)
  50. #if defined(WOLFSSL_DLL)
  51. #define WOLFSSL_API __declspec(dllimport)
  52. #else
  53. #define WOLFSSL_API
  54. #endif
  55. #define WOLFSSL_LOCAL
  56. #else
  57. #define WOLFSSL_API
  58. #define WOLFSSL_LOCAL
  59. #endif
  60. #endif /* BUILDING_WOLFSSL */
  61. /* WOLFSSL_ABI is used for public API symbols that must not change
  62. * their signature. This tag is used for all APIs that are a
  63. * part of the fixed ABI.
  64. */
  65. #define WOLFSSL_ABI
  66. #endif /* WOLF_CRYPT_VISIBILITY_H */