declspec.hpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #ifndef BOOST_CONTRACT_DETAIL_DECLSPEC_HPP_
  2. #define BOOST_CONTRACT_DETAIL_DECLSPEC_HPP_
  3. // Copyright (C) 2008-2018 Lorenzo Caminiti
  4. // Distributed under the Boost Software License, Version 1.0 (see accompanying
  5. // file LICENSE_1_0.txt or a copy at http://www.boost.org/LICENSE_1_0.txt).
  6. // See: http://www.boost.org/doc/libs/release/libs/contract/doc/html/index.html
  7. // IMPORTANT: Indirectly included by contract_macro.hpp so trivial headers only.
  8. #include <boost/contract/core/config.hpp> // No compile-time overhead.
  9. #include <boost/config.hpp>
  10. /* PUBLIC */
  11. // IMPORTANT: In general, this library should always and only be compiled and
  12. // used as a shared library. Otherwise, lib's state won't be shared among
  13. // different user programs and user libraries. However, this library can be
  14. // safely compiled and used as a static or header-only library only when it is
  15. // being used by a single program unit (e.g., a single program with only
  16. // statically linked libraries that check contracts).
  17. #ifdef BOOST_CONTRACT_DYN_LINK
  18. #ifdef BOOST_CONTRACT_SOURCE
  19. #define BOOST_CONTRACT_DETAIL_DECLSPEC BOOST_SYMBOL_EXPORT
  20. #else
  21. #define BOOST_CONTRACT_DETAIL_DECLSPEC BOOST_SYMBOL_IMPORT
  22. #endif
  23. #else
  24. #define BOOST_CONTRACT_DETAIL_DECLSPEC /* nothing */
  25. #endif
  26. #ifdef BOOST_CONTRACT_HEADER_ONLY
  27. #define BOOST_CONTRACT_DETAIL_DECLINLINE inline
  28. #else
  29. #define BOOST_CONTRACT_DETAIL_DECLINLINE /* nothing */
  30. // Automatically link this lib to correct build variant (for MSVC, etc.).
  31. #if !defined(BOOST_ALL_NO_LIB) && \
  32. !defined(BOOST_CONTRACT_NO_LIB) && \
  33. !defined(BOOST_CONTRACT_SOURCE)
  34. #define BOOST_LIB_NAME boost_contract // This lib (static or shared).
  35. #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CONTRACT_DYN_LINK)
  36. #define BOOST_DYN_LINK // This lib as shared.
  37. #endif
  38. #include <boost/config/auto_link.hpp> // Also #undef BOOST_LIB_NAME.
  39. #endif
  40. #endif
  41. #endif // #include guard