id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 4959,Linking Serialization static lib to a DLL breaks auto-import in MinGW,jlcastillo@…,Robert Ramey,"With MinGW GCC 4.51 and Boost 1.45, boost being compiled with the following command line: {{{ bjam toolset=gcc --build-type=complete --threading=multi variant=release link=static runtime-link=shared stage --stagedir=$RELEASE_LIB_DIR -j2 bjam toolset=gcc --build-type=complete --threading=multi variant=debug link=static runtime-link=shared stage --stagedir=$DEBUG_LIB_DIR -j2 }}} The static serialization lib attaches ""declspec(dllexport)"" to some methods in boost/serialization/singleton.hpp, i.e. get_mutable_instance, get_const_instance and is_destroyed. This is OK if we link the static library against an executable. If we however link it against a DLL, GCC stops exporting automatically all the symbols in the source code of the DLL (auto-import feature), and switches to a linking mode where only those functions declared with ""declspec(dllexport)"" are exported. This is very inconvenient and hard to track if you use an automatic build environment like Boost Build (bjam). We fixed it adding the following lines to /boost/serialization/force_include.hpp: {{{ #if defined(BOOST_HAS_DECLSPEC) && !defined(__COMO__) # if defined(__BORLANDC__) # define BOOST_DLLEXPORT __export # elif defined(__MINGW32__) // JOSE FIX !!!! # if defined(__GNUC__) && (__GNUC__ >= 3) # define BOOST_USED __attribute__ ((used)) # endif # 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(???????) && (?????? >= 1110) # define BOOST_USED __attribute__ ((used)) # elif defined(__INTEL_COMPILER) && (BOOST_INTEL_CXX_VERSION >= 800) # define BOOST_USED __attribute__ ((used)) # endif #endif }}} You need to recompile the Boost Serialization static library with these changes, and make sure you have the modified force_include.hpp in the boost include that your apps use during compilation. ",Bugs,closed,To Be Determined,serialization,Boost 1.45.0,Problem,invalid,,