summaryrefslogtreecommitdiff
path: root/libs/config/test/link/link_test.hpp
blob: 8d6333bba64765405517a83e46ed0609d0e6da9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//  (C) Copyright John Maddock 2003. 
//  Use, modification and distribution are subject to the 
//  Boost Software License, Version 1.0. (See accompanying file 
//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

//  See http://www.boost.org/libs/config for the most recent version.

#ifndef BOOST_LINK_TEST_HPP
#define BOOST_LINK_TEST_HPP

#include <boost/config.hpp>

//
// set up code to determine our compilers options, 
// we will check that these are the same in the
// .exe and the .dll:
//
#ifdef BOOST_DYN_LINK
static const bool dyn_link = true;
#else
static const bool dyn_link = false;
#endif
#if defined(_DLL) || defined(_RTLDLL)
static const bool dyn_rtl = true;
#else
static const bool dyn_rtl = false;
#endif
#if defined(BOOST_HAS_THREADS)
static const bool has_threads = true;
#else
static const bool has_threads = false;
#endif
#if defined(_DEBUG)
static const bool debug = true;
#else
static const bool debug = false;
#endif
#if defined(__STL_DEBUG) || defined(_STLP_DEBUG)
static const bool stl_debug = true;
#else
static const bool stl_debug = false;
#endif

//
// set up import and export options:
//
#if defined(BOOST_DYN_LINK)
#  ifdef BOOST_CONFIG_SOURCE
#      define BOOST_CONFIG_DECL BOOST_SYMBOL_EXPORT
#  else
#      define BOOST_CONFIG_DECL BOOST_SYMBOL_IMPORT
#  endif
#endif
#ifndef BOOST_CONFIG_DECL
#  define BOOST_CONFIG_DECL
#endif

//
// define our entry point:
//
bool BOOST_CONFIG_DECL check_options(
                   bool m_dyn_link,
                   bool m_dyn_rtl,
                   bool m_has_threads,
                   bool m_debug,
                   bool m_stlp_debug);

//
// set up automatic linking:
//
#if !defined(BOOST_CONFIG_SOURCE) && !defined(BOOST_CONFIG_NO_LIB)
#  define BOOST_LIB_NAME link_test
#  include <boost/config/auto_link.hpp>
#endif

#ifndef BOOST_NO_EXTERN_TEMPLATE

template <class T>
T test_free_proc(T v)
{
   return v;
}

template <class T>
struct tester
{
   static int test();
};

template <class T>
int tester<T>::test()
{
   return 0;
}

#ifdef BOOST_CONFIG_SOURCE
template BOOST_SYMBOL_EXPORT int test_free_proc<int>(int);
template BOOST_SYMBOL_EXPORT int tester<int>::test();
#else
extern template BOOST_SYMBOL_IMPORT int test_free_proc<int>(int);
extern template BOOST_SYMBOL_IMPORT int tester<int>::test();
#endif

#endif // BOOST_NO_EXTERN_TEMPLATE

#endif // BOOST_LINK_TEST_HPP