Boost logo

Boost Users :

Subject: [Boost-users] [serialization] boost::serialization adds huge amounts of exports to resultant Windows PE file
From: Chris Yuen (kizzx2+boost_at_[hidden])
Date: 2010-09-29 20:08:52


Hey guys,

I am using boost::serialization from 1.44.0. One thing that I noticed
is that linking statically to the serialization libs will add several
hundred exports in the final exe file that I get. Using `dumpbin
/exports my_program.exe`

Here's a brief illustration:

Let's say we have a typical Hello World program (code example at the
end of this message) that uses `iostream`. Here's what we get when we
run `dumpbin /exports my_program.exe`.

   Dump of file my_program.exe

   File Type: EXECUTABLE IMAGE

     Summary

           4000 .data
           2000 .pdata
           7000 .rdata
           1000 .rsrc
          18000 .text

However, if we just add 6 lines of code to include
boost::serialization (code example at the end of this message), we
would get tons of exports.

   Dump of file my_program.exe

   File Type: EXECUTABLE IMAGE

   Section contains the following exports for my_program.exe

   00000000 characteristics
   4CA376FA time date stamp Thu Sep 30 01:27:22 2010
       0.00 version
          1 ordinal base
         14 number of functions
         14 number of names

   ordinal hint RVA name

         1 0 00029480
??_B?1??get_instance@?$singleton_at_V?$map_at_Vtext_oarchive_at_archive@boost@@@?A0xca82ee40_at_detail@archive_at_boost@@@serialization_at_boost@@CAAEAV?$map_at_Vtext_oarchive_at_archive@boost@@@?A0xca82ee40_at_detail@archive_at_3@XZ_at_51
= ??_B?1??get_instance@?$singleton_at_V?$map_at_Vtext_oarchive_at_archive@boost@@@?A0xca82ee40_at_detail@archive_at_boost@@@serialization_at_boost@@CAAEAV?$map_at_Vtext_oarchive_at_archive@boost@@@?A0xca82ee40_at_detail@archive_at_3@XZ_at_51
(`private: static class boost::archive::detail::`anonymous
namespace'::map<class boost::archive::text_oarchive> & __cdecl
boost::serialization::singleton<class
boost::archive::detail::`anonymous namespace'::map<class
boost::archive::text_oarchive> >::get_instance(void)'::`2'::`local
static guard'{2}')
         2 1 000294B0
??_B?1??get_instance@?$singleton_at_V?$multiset_at_PEBVextended_type_info_at_serialization@boost@@Ukey_compare_at_detail@23_at_V?$allocator_at_PEBVextended_type_info_at_serialization@boost@@@std@@@std@@@serialization_at_boost@@CAAEAV?$multiset_at_PEBVextended_type_info_at_serialization@boost@@Ukey_compare_at_detail@23_at_V?$allocator_at_PEBVextended_type_info_at_serialization@boost@@@std@@@std@@XZ_at_51
= ??_B?1??get_instance@?$singleton_at_V?$multiset_at_PEBVextended_type_info_at_serialization@boost@@Ukey_compare_at_detail@23_at_V?$allocator_at_PEBVextended_type_info_at_serialization@boost@@@std@@@std@@@serialization_at_boost@@CAAEAV?$multi

   ...elided

This is indeed very strange since compiling a `exe` file shouldn't get
me any of these "exports" at all. Anyone has an idea what's going
wrong?

I am using MSVS2005 Release|x64. I compiled boost with `bjam
threading=multi link=static runtime-link=static toolset=msvc-8.0`.

Thank you for guidance in advance!

Best regards,
Chris Yuen

   // Source code to my_program.exe
   #include <iostream>
   #include <sstream>

   // Uncommenting the following block would introduce tons of
   // exports in the final exe. Even though this block of code
   // is never executed.
   //#include <boost/archive/text_oarchive.hpp>
   //void nothing() {
       //std::stringstream stream;
       //boost::archive::text_oarchive oa(stream);
   //}

   int main() {
       using namespace std;
       std::cout << "Hello World" << std::endl;
       return 0;
   }


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net