link_test.hpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // (C) Copyright John Maddock 2003.
  2. // Use, modification and distribution are subject to the
  3. // Boost Software License, Version 1.0. (See accompanying file
  4. // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. // See http://www.boost.org/libs/config for the most recent version.
  6. #ifndef BOOST_LINK_TEST_HPP
  7. #define BOOST_LINK_TEST_HPP
  8. #include <boost/config.hpp>
  9. //
  10. // set up code to determine our compilers options,
  11. // we will check that these are the same in the
  12. // .exe and the .dll:
  13. //
  14. #ifdef BOOST_DYN_LINK
  15. static const bool dyn_link = true;
  16. #else
  17. static const bool dyn_link = false;
  18. #endif
  19. #if defined(_DLL) || defined(_RTLDLL)
  20. static const bool dyn_rtl = true;
  21. #else
  22. static const bool dyn_rtl = false;
  23. #endif
  24. #if defined(BOOST_HAS_THREADS)
  25. static const bool has_threads = true;
  26. #else
  27. static const bool has_threads = false;
  28. #endif
  29. #if defined(_DEBUG)
  30. static const bool debug = true;
  31. #else
  32. static const bool debug = false;
  33. #endif
  34. #if defined(__STL_DEBUG) || defined(_STLP_DEBUG)
  35. static const bool stl_debug = true;
  36. #else
  37. static const bool stl_debug = false;
  38. #endif
  39. //
  40. // set up import and export options:
  41. //
  42. #if defined(BOOST_DYN_LINK)
  43. # ifdef BOOST_CONFIG_SOURCE
  44. # define BOOST_CONFIG_DECL BOOST_SYMBOL_EXPORT
  45. # else
  46. # define BOOST_CONFIG_DECL BOOST_SYMBOL_IMPORT
  47. # endif
  48. #endif
  49. #ifndef BOOST_CONFIG_DECL
  50. # define BOOST_CONFIG_DECL
  51. #endif
  52. //
  53. // define our entry point:
  54. //
  55. bool BOOST_CONFIG_DECL check_options(
  56. bool m_dyn_link,
  57. bool m_dyn_rtl,
  58. bool m_has_threads,
  59. bool m_debug,
  60. bool m_stlp_debug);
  61. //
  62. // set up automatic linking:
  63. //
  64. #if !defined(BOOST_CONFIG_SOURCE) && !defined(BOOST_CONFIG_NO_LIB)
  65. # define BOOST_LIB_NAME link_test
  66. # include <boost/config/auto_link.hpp>
  67. #endif
  68. #ifndef BOOST_NO_CXX11_EXTERN_TEMPLATE
  69. template <class T>
  70. T test_free_proc(T v)
  71. {
  72. return v;
  73. }
  74. template <class T>
  75. struct tester
  76. {
  77. static int test();
  78. };
  79. template <class T>
  80. int tester<T>::test()
  81. {
  82. return 0;
  83. }
  84. #ifdef BOOST_CONFIG_SOURCE
  85. template BOOST_SYMBOL_EXPORT int test_free_proc<int>(int);
  86. template BOOST_SYMBOL_EXPORT int tester<int>::test();
  87. #else
  88. extern template BOOST_SYMBOL_IMPORT int test_free_proc<int>(int);
  89. extern template BOOST_SYMBOL_IMPORT int tester<int>::test();
  90. #endif
  91. #endif // BOOST_NO_CXX11_EXTERN_TEMPLATE
  92. #endif // BOOST_LINK_TEST_HPP