
Robert: Thanks for the info. From the gdb output, my program was still single-threaded when it seg-faults: (gdb) info thread * 1 thread 3800.0x3f8 0x6e3759a3 in boost::archive::detail::basic_serializer::basic_serializer (this=0x4, eti=@0x816484) at c:/e2e/prj/awit.hipeer.trunk/contrib/oss.boost.release/boost_1_33_1/boost/archive/detail/basic_serializer.hpp:37 I do find a workaround for my problem: use a single complication unit (*.o) for all my *.cpp files that does #include serialization headers, which are <boost/serialization/nvp.hpp>, <boost/serialization/shared_ptr.hpp>, and <boost/serialization/vector.hpp>. These *.cpp files used to scatter in multiple *.o files, which are archived into a lib*.a file before statically linked with the one with main(). Since the program halts at the get_instance() call at line boost_1_33_1/boost/serialization/extended_type_info_typeid.hpp:95, I'm wondering the discussion a few months ago: Re: Boost serialization : concurrency (was Possibletoappend...)<http://news.gmane.org/find-root.php?message_id=%3ceektei%248hm%241%40sea.gmane.org%3e> has anything to do with the safety of local static access across multiple C++ compilation unit, in addition to issues with thread-safety. Anyway, is there any documentation on how to use boost::serialization library correctly across multiple DLLs & explain what it is doing during initialization/destruction time? Again, thanks for your hint, as well as the wonderful boost serialization library. --- Jeffrey On 9/26/06, Robert Ramey <ramey@rrsd.com> wrote:
It has been recently discovered that, contrary to intention and belief, archives are not currently thread-safe.
The issue is currently being investigated but a fix won't appear before version 1.35 - at the earliest.
In the mean time, perhaps you can avoid the issue by sycronizing access to archives.
Robert Ramey
"Jeffrey Chang" <jeffrey8chang@gmail.com> wrote in message news:8782a5590609261636j3ee55435pe578c78290ec7d1c@mail.gmail.com... Robert:
Yes, this program uses boost multi-thread library of "boost_thread-mgw-mt-d-1_33_1.dll". boost::asio library (header only) is also used.
--- Jeffrey
On 9/26/06, Robert Ramey <ramey@rrsd.com> wrote:
Just out of curiosity? are you doing multi-threading?
Robert Ramey
"Jeffrey Chang" <jeffrey8chang@gmail.com> wrote in message news:8782a5590609261453p6f8542cfp2cb64d86754527c7@mail.gmail.com ... Hi,
I've been using boost Serialization library (release v1_33_1) on Linux without problems, with g++ compiler of both v3.3.6 & v4.1.1. My program serialzes boost::shared_ptr of polymorphic types, and BOOST_CLASS_EXPORT() and BOOST_SERIALIZATION_SHARED_PTR() are used.
However, when the same program is ported & run on mingw32 (w/ g++ v3.4.5on WinXP), it generates SIGSEGV before my main() is called. and here's the stack trace:
Program received signal SIGSEGV, Segmentation fault. 0x6e3759a3 in boost::archive::detail::basic_serializer::basic_serializer ( this=0x4, eti=@0x813484) at /opt/boost/boost_1_33_1/boost/archive/detail/basic_serializer.hpp:37 37 {} (gdb) bt #0 0x6e3759a3 in boost::archive::detail::basic_serializer::basic_serializer ( this=0x4, eti=@0x813484) at /opt/boost/boost_1_33_1/boost/archive/detail/basic_serializer.hpp:37 #1 0x6e34220b in boost::archive::detail::basic_oserializer::basic_oserializer (this=0x0, eti=@0x813484) at /opt/boost/boost_1_33_1/libs/serialization/build/../src/basic_oserializer.cpp:24 #2 0x005fb394 in boost::archive::detail::pointer_oserializer<HmcBase, boost::archive::text_oarchive>::pointer_oserializer (this=0x813164) at /opt/boost/boost_1_33_1/boost/serialization/extended_type_info_typeid.hpp:95 #3 0x00477c12 in __static_initialization_and_destruction_1 ( __initialize_p=8467588, __priority=65535) at /opt/boost/boost_1_33_1/boost/archive/detail/oserializer.hpp:198 #4 0x004c5a57 in __main () at /opt/boost/boost_1_33_1/boost/archive/detail/oserializer.hpp:198 #5 0x00404568 in main (argc=1, argv=0x3d45f8) at ../../src/HmcMain.cpp:231 (gdb)
I cannot connect the logic between stack frame #3 and #2; it seems trying to instantiate some global static data when SIGSEGV happens. Is there some dependency on order of global static data initialization to be satisfied for using BOOST_CLASS_EXPORT/BOOST_SERIALIZATION_SHARED_PTR? HmcBase is the base class for my polymorphic types, and all my code are statically linked, while "boost_serialization-mgw-d-1_33_1.dll" is used here. I saw some discussion in this mailing list on "Serializing classes defined in DLLs" <http://news.gmane.org/find-root.php?message_id=%3c432FF0C3.5010002%40intopii.fi%3e>a year ago, but don't know what's the current status on it and whether this case is related to it.
Thanks for any hit,
--- Jeffrey
------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
------------------------------
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users