[serialization] boost::serialization adds huge amounts of exports to resultant Windows PE file
Chris, Boost serialization defaults lots of classes/functions to be automatically exported. This is done in \boost\serialization\force_include.hpp: #if defined(BOOST_HAS_DECLSPEC) && !defined(__COMO__) # if defined(__BORLANDC__) # define BOOST_DLLEXPORT __export # else # define BOOST_DLLEXPORT __declspec(dllexport) # endif #elif ! defined(_WIN32) && ! defined(_WIN64) # if defined(__MWERKS__) # define BOOST_DLLEXPORT __declspec(dllexport) # elif defined(__GNUC__) && (__GNUC__ >= 3) # define BOOST_USED __attribute__ ((used)) # elif defined(__IBMCPP__) && (__IBMCPP__ >= 1110) # define BOOST_USED __attribute__ ((used)) # elif defined(__INTEL_COMPILER) && (BOOST_INTEL_CXX_VERSION >= 800) # define BOOST_USED __attribute__ ((used)) # endif #endif The easiest workaround for this is: 1. Place your serialization #include lines in a precompiled header. 2. Right after all your boost serialization #includes, write this: #ifdef BOOST_DLLEXPORT #undef BOOST_DLLEXPORT // it was '__declspec(dllexport)' #define BOOST_DLLEXPORT // now it's '' #endif Just rebuild your project and you'll see all exports gone. No need to recompile boost serialization lib as functions affected are templates. Regards, Matheus
participants (1)
-
Matheus Peschke de Azevedo