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