changeset 1335:2b7f7e06976b

improved test program and portability patches for package boost
author Lothar May <lothar.imap@googlemail.com>
date Sat, 23 Oct 2010 00:04:16 +0200
parents 5aa60cef7fd6
children 01510a2ca4bf
files src/boost-1-fixes.patch src/boost-test.cpp
diffstat 2 files changed, 59 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/boost-1-fixes.patch	Sat Oct 23 00:04:16 2010 +0200
@@ -0,0 +1,44 @@
+This file is part of mingw-cross-env.
+See doc/index.html for further information.
+
+These patches have been taken from:
+https://svn.boost.org/trac/boost/changeset/66006
+https://svn.boost.org/trac/boost/changeset/66140
+
+--- trunk/boost/asio/error.hpp	(revision 62499)
++++ trunk/boost/asio/error.hpp	(revision 66006)
+@@ -20,5 +20,5 @@
+ #include <boost/system/error_code.hpp>
+ #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
+-# include <WinError.h>
++# include <winerror.h>
+ #else
+ # include <cerrno>
+--- trunk/libs/thread/src/win32/tss_pe.cpp	(revision 62718)
++++ trunk/libs/thread/src/win32/tss_pe.cpp	(revision 66140)
+@@ -39,4 +39,10 @@
+ }
+ 
++#if (__MINGW32_MAJOR_VERSION >3) || ((__MINGW32_MAJOR_VERSION==3) && (__MINGW32_MINOR_VERSION>=18))
++extern "C"
++{
++    PIMAGE_TLS_CALLBACK __crt_xl_tls_callback__ __attribute__ ((section(".CRT$XLB"))) = on_tls_callback;
++}
++#else
+ extern "C" {
+ 
+@@ -51,8 +57,6 @@
+ 
+     PIMAGE_TLS_CALLBACK __crt_xl_start__ __attribute__ ((section(".CRT$XLA"))) = 0;
+-    PIMAGE_TLS_CALLBACK __crt_xl_tls_callback__ __attribute__ ((section(".CRT$XLB"))) = on_tls_callback;
+     PIMAGE_TLS_CALLBACK __crt_xl_end__ __attribute__ ((section(".CRT$XLZ"))) = 0;
+ }
+-
+ extern "C" const IMAGE_TLS_DIRECTORY32 _tls_used __attribute__ ((section(".rdata$T"))) =
+ {
+@@ -64,4 +68,5 @@
+         (DWORD) 0
+ };
++#endif
+ 
+ 
--- a/src/boost-test.cpp	Fri Oct 22 23:32:45 2010 +0200
+++ b/src/boost-test.cpp	Sat Oct 23 00:04:16 2010 +0200
@@ -3,6 +3,18 @@
 
 #include <iostream>
 #include <boost/archive/xml_oarchive.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/thread/tss.hpp>
+
+boost::thread_specific_ptr<int> ptr;
+
+void test_thread()
+{
+    if (ptr.get() == 0) {
+        ptr.reset(new int(0));
+    }
+    std::cout << "Hello, World! from thread" << std::endl;
+}
 
 int main(int argc, char *argv[])
 {
@@ -13,5 +25,8 @@
     std::string s = "\n\n    Hello, World!\n\n";
     oa << BOOST_SERIALIZATION_NVP(s);
 
+    boost::thread thrd(test_thread);
+    thrd.join();
+
     return 0;
 }