Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62332 - in trunk/libs/config/test/link: . test
From: john_at_[hidden]
Date: 2010-05-30 13:31:10


Author: johnmaddock
Date: 2010-05-30 13:31:09 EDT (Sun, 30 May 2010)
New Revision: 62332
URL: http://svn.boost.org/trac/boost/changeset/62332

Log:
Update link_test to check that separate file template instantiation and export works as expected.
Text files modified:
   trunk/libs/config/test/link/Jamfile.v2 | 3 +++
   trunk/libs/config/test/link/link_test.cpp | 38 +++++++++++++++++++++++++++++++++-----
   trunk/libs/config/test/link/link_test.hpp | 37 ++++++++++++++++++++++++++++++++++---
   trunk/libs/config/test/link/main.cpp | 4 ++++
   trunk/libs/config/test/link/test/Jamfile.v2 | 6 ++++--
   5 files changed, 78 insertions(+), 10 deletions(-)

Modified: trunk/libs/config/test/link/Jamfile.v2
==============================================================================
--- trunk/libs/config/test/link/Jamfile.v2 (original)
+++ trunk/libs/config/test/link/Jamfile.v2 2010-05-30 13:31:09 EDT (Sun, 30 May 2010)
@@ -14,3 +14,6 @@
         debug release
     ;
 
+run main.cpp link_test : : : <define>BOOST_DYN_LINK=1 <define>BOOST_CONFIG_NO_LIB <link>shared <runtime-link>shared <threading>single : link_test_test ;
+
+

Modified: trunk/libs/config/test/link/link_test.cpp
==============================================================================
--- trunk/libs/config/test/link/link_test.cpp (original)
+++ trunk/libs/config/test/link/link_test.cpp 2010-05-30 13:31:09 EDT (Sun, 30 May 2010)
@@ -9,6 +9,8 @@
 #define BOOST_CONFIG_SOURCE
 
 #include "link_test.hpp"
+#include <iostream>
+#include <iomanip>
 
 bool BOOST_CONFIG_DECL check_options(
                    bool m_dyn_link,
@@ -17,10 +19,36 @@
                    bool m_debug,
                    bool m_stlp_debug)
 {
- return (m_dyn_link == dyn_link)
- && (m_dyn_rtl == dyn_rtl)
- && (m_has_threads == has_threads)
- && (m_debug == debug)
- && (m_stlp_debug == stl_debug);
+ if(m_dyn_link != dyn_link)
+ {
+ std::cout << "Dynamic link options do not match" << std::endl;
+ std::cout << "Application setting = " << m_dyn_link << " Library setting = " << dyn_link << std::endl;
+ return false;
+ }
+ if(m_dyn_rtl != dyn_rtl)
+ {
+ std::cout << "Runtime library options do not match" << std::endl;
+ std::cout << "Application setting = " << m_dyn_rtl << " Library setting = " << dyn_rtl << std::endl;
+ return false;
+ }
+ if(m_has_threads != has_threads)
+ {
+ std::cout << "Threading options do not match" << std::endl;
+ std::cout << "Application setting = " << m_has_threads << " Library setting = " << has_threads << std::endl;
+ return false;
+ }
+ if(m_debug != debug)
+ {
+ std::cout << "Debug options do not match" << std::endl;
+ std::cout << "Application setting = " << m_debug << " Library setting = " << debug << std::endl;
+ return false;
+ }
+ if(m_stlp_debug != stl_debug)
+ {
+ std::cout << "STLPort debug options do not match" << std::endl;
+ std::cout << "Application setting = " << m_stlp_debug << " Library setting = " << stl_debug << std::endl;
+ return false;
+ }
+ return true;
 }
 

Modified: trunk/libs/config/test/link/link_test.hpp
==============================================================================
--- trunk/libs/config/test/link/link_test.hpp (original)
+++ trunk/libs/config/test/link/link_test.hpp 2010-05-30 13:31:09 EDT (Sun, 30 May 2010)
@@ -44,11 +44,11 @@
 //
 // set up import and export options:
 //
-#if defined(BOOST_HAS_DECLSPEC) && defined(BOOST_DYN_LINK)
+#if defined(BOOST_DYN_LINK)
 # ifdef BOOST_CONFIG_SOURCE
-# define BOOST_CONFIG_DECL __declspec(dllexport)
+# define BOOST_CONFIG_DECL BOOST_SYMBOL_EXPORT
 # else
-# define BOOST_CONFIG_DECL __declspec(dllimport)
+# define BOOST_CONFIG_DECL BOOST_SYMBOL_IMPORT
 # endif
 #endif
 #ifndef BOOST_CONFIG_DECL
@@ -73,5 +73,36 @@
 # 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
 
+

Modified: trunk/libs/config/test/link/main.cpp
==============================================================================
--- trunk/libs/config/test/link/main.cpp (original)
+++ trunk/libs/config/test/link/main.cpp 2010-05-30 13:31:09 EDT (Sun, 30 May 2010)
@@ -9,6 +9,10 @@
 
 int main()
 {
+#ifndef BOOST_NO_EXTERN_TEMPLATE
+ test_free_proc<int>(0);
+ tester<int>::test();
+#endif
    return check_options(dyn_link, dyn_rtl, has_threads, debug, stl_debug) ? 0 : -1;
 }
 

Modified: trunk/libs/config/test/link/test/Jamfile.v2
==============================================================================
--- trunk/libs/config/test/link/test/Jamfile.v2 (original)
+++ trunk/libs/config/test/link/test/Jamfile.v2 2010-05-30 13:31:09 EDT (Sun, 30 May 2010)
@@ -69,13 +69,14 @@
     :
     ;
     
+
 explicit link_test ;
 
 run ../main.cpp link_test
- : : : <toolset>msvc-8.0:<build>no <link>static <runtime-link>static <threading>single debug : link_test_ssd ;
+ : : : <toolset>msvc-8.0:<build>no <toolset>msvc-9.0:<build>no <toolset>msvc-10.0:<build>no <link>static <runtime-link>static <threading>single debug : link_test_ssd ;
 
 run ../main.cpp link_test
- : : : <toolset>msvc-8.0:<build>no <link>static <runtime-link>static <threading>single release : link_test_ssr ;
+ : : : <toolset>msvc-8.0:<build>no <toolset>msvc-9.0:<build>no <toolset>msvc-10.0:<build>no <link>static <runtime-link>static <threading>single release : link_test_ssr ;
 
 run ../main.cpp link_test
   : : : <link>static <runtime-link>static <threading>multi debug : link_test_smd ;
@@ -113,3 +114,4 @@
 
 
 
+


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk