diff --git a/build/gcc.mak b/build/gcc.mak index 49bd34ee..4ca4d193 100644 --- a/build/gcc.mak +++ b/build/gcc.mak @@ -95,6 +95,7 @@ boost_regex_clean : ./gcc/libboost_regex.a : gcc/boost_regex/c_regex_traits.o gcc/boost_regex/c_regex_traits_common.o gcc/boost_regex/cpp_regex_traits.o gcc/boost_regex/cregex.o gcc/boost_regex/fileiter.o gcc/boost_regex/instances.o gcc/boost_regex/posix_api.o gcc/boost_regex/regex.o gcc/boost_regex/regex_debug.o gcc/boost_regex/regex_synch.o gcc/boost_regex/w32_regex_traits.o gcc/boost_regex/wide_posix_api.o gcc/boost_regex/winstances.o ar -r gcc/libboost_regex.a gcc/boost_regex/c_regex_traits.o gcc/boost_regex/c_regex_traits_common.o gcc/boost_regex/cpp_regex_traits.o gcc/boost_regex/cregex.o gcc/boost_regex/fileiter.o gcc/boost_regex/instances.o gcc/boost_regex/posix_api.o gcc/boost_regex/regex.o gcc/boost_regex/regex_debug.o gcc/boost_regex/regex_synch.o gcc/boost_regex/w32_regex_traits.o gcc/boost_regex/wide_posix_api.o gcc/boost_regex/winstances.o + -ar -s gcc/libboost_regex.a ######################################################## # @@ -148,4 +149,5 @@ boost_regex_debug_clean : ./gcc/libboost_regex_debug.a : gcc/boost_regex_debug/c_regex_traits.o gcc/boost_regex_debug/c_regex_traits_common.o gcc/boost_regex_debug/cpp_regex_traits.o gcc/boost_regex_debug/cregex.o gcc/boost_regex_debug/fileiter.o gcc/boost_regex_debug/instances.o gcc/boost_regex_debug/posix_api.o gcc/boost_regex_debug/regex.o gcc/boost_regex_debug/regex_debug.o gcc/boost_regex_debug/regex_synch.o gcc/boost_regex_debug/w32_regex_traits.o gcc/boost_regex_debug/wide_posix_api.o gcc/boost_regex_debug/winstances.o ar -r gcc/libboost_regex_debug.a gcc/boost_regex_debug/c_regex_traits.o gcc/boost_regex_debug/c_regex_traits_common.o gcc/boost_regex_debug/cpp_regex_traits.o gcc/boost_regex_debug/cregex.o gcc/boost_regex_debug/fileiter.o gcc/boost_regex_debug/instances.o gcc/boost_regex_debug/posix_api.o gcc/boost_regex_debug/regex.o gcc/boost_regex_debug/regex_debug.o gcc/boost_regex_debug/regex_synch.o gcc/boost_regex_debug/w32_regex_traits.o gcc/boost_regex_debug/wide_posix_api.o gcc/boost_regex_debug/winstances.o + -ar -s gcc/libboost_regex_debug.a diff --git a/build/gcc_gen.sh b/build/gcc_gen.sh index 63dc5445..f630dd72 100644 --- a/build/gcc_gen.sh +++ b/build/gcc_gen.sh @@ -77,6 +77,7 @@ EOF else echo ./$subdir/lib$libname.a : $all_obj >> $tout echo " ar -r $subdir/lib$libname.a $all_obj" >> $tout + echo " -ar -s $subdir/lib$libname.a" >> $tout fi echo "" >> $tout } @@ -234,3 +235,4 @@ gcc_gen_shared # remove tmep files; rm -f $tout $iout + diff --git a/src/c_regex_traits.cpp b/src/c_regex_traits.cpp index d4aaca59..eb671cb1 100644 --- a/src/c_regex_traits.cpp +++ b/src/c_regex_traits.cpp @@ -664,7 +664,9 @@ void BOOST_REGEX_CALL c_regex_traits::m_free() re_free_classes(); re_free_collate(); --entry_count; - if(entry_count == 0) + // add reference to static member here to ensure + // that the linker includes it in the .exe: + if((entry_count == 0) && (0 != &c_regex_traits::i)) { delete ctype_name; delete collate_name; @@ -888,7 +890,9 @@ void BOOST_REGEX_CALL c_regex_traits::m_free() re_message_free(); re_free_classes(); re_free_collate(); - if(nlsw_count == 0) + // add reference to static member here to ensure + // that the linker includes it in the .exe: + if((nlsw_count == 0) && (0 != &c_regex_traits::init_)) { // cleanup: delete wlocale_name; diff --git a/src/w32_regex_traits.cpp b/src/w32_regex_traits.cpp index fd10d5d2..fb1aee30 100644 --- a/src/w32_regex_traits.cpp +++ b/src/w32_regex_traits.cpp @@ -382,9 +382,12 @@ void BOOST_REGEX_CALL w32_traits_base::do_free() { BOOST_RE_GUARD_STACK delete[] pclasses; + pclasses = 0; delete pcoll_names; + pcoll_names = 0; #ifndef BOOST_NO_WREGEX delete syntax; + syntax = 0; #endif if(hresmod) { @@ -399,6 +402,7 @@ void BOOST_REGEX_CALL w32_traits_base::do_free() re_custom_error_messages[i] = 0; } } + is_init = false; } std::string BOOST_REGEX_CALL w32_traits_base::error_string(unsigned id) @@ -498,7 +502,9 @@ w32_regex_traits::~w32_regex_traits() #ifdef BOOST_HAS_THREADS re_detail::cs_guard g(*re_detail::p_re_lock); #endif - if(--entry_count == 0) + // add reference to static member here to ensure + // that the linker includes it in the .exe: + if((--entry_count == 0) && (0 != &w32_regex_traits::i)) do_free(); #ifdef BOOST_HAS_THREADS g.acquire(false); @@ -665,7 +671,9 @@ w32_regex_traits::~w32_regex_traits() #ifdef BOOST_HAS_THREADS re_detail::cs_guard g(*re_detail::p_re_lock); #endif - if(--entry_count == 0) + // add reference to static member here to ensure + // that the linker includes it in the .exe: + if((--entry_count == 0) && (0 != &w32_regex_traits::init_)) do_free(); #ifdef BOOST_HAS_THREADS g.acquire(false); diff --git a/test/regress/tests.cpp b/test/regress/tests.cpp index 3ae3ea98..30259b75 100644 --- a/test/regress/tests.cpp +++ b/test/regress/tests.cpp @@ -26,6 +26,10 @@ #include #include "regress.h" +# ifdef BOOST_MSVC +# pragma warning(disable: 4244 4267) +#endif + using namespace boost; template