id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 12417,Linking dynamically to boost::locale::info class on Windows fails when auto-linking is disabled,anonymous,Artyom Beilis,"There appears to be a name-mangling issue in boost::locale::info related to a public static member variable of type std::locale::id, only when linking to the DLL on Windows. When using auto-linking, there is no problem. == Setup == Boost 1.61 (tested on both pre-built and from-source libraries), Windows 10 x64, MSVC 2015 (cl 19.00.24213.1), using x64 compiler. == Code == bugtest.cc {{{ #include #include int main() { std::locale::global(boost::locale::generator().generate(""en_US.UTF-8"")); std::cout << std::use_facet(std::locale()).name() << std::endl; } }}} == Compiler Command == {{{ cl.exe -IC:\Boost\include\boost-1_61 -DBOOST_ALL_NO_LIB -EHsc -O2 bugtest.cc -link -libpath:c:\Boost\lib boost_locale-vc140-mt-1_61.lib }}} == Linker Failure == bugtest.obj : error LNK2019: unresolved external symbol ""public: static class std::locale::id boost::locale::info::id"" (?id@info@locale@boost@@2V02std@@A) referenced in function ""class boost::locale::info const & __cdecl std::use_facet(class std::locale const &)"" (??$use_facet@Vinfo@locale@boost@@@std@@YAAEBVinfo@locale@boost@@AEBV20@@Z) bugtest.exe : fatal error LNK1120: 1 unresolved externals == Workaround == Force dllimport attribute {{{ cl.exe -IC:\Boost\include\boost-1_61 -DBOOST_LOCALE_DECL=__declspec(dllimport) -DBOOST_ALL_NO_LIB -EHsc -O2 bugtest.cc -link -libpath:c:\Boost\lib boost_locale-vc140-mt-1_61.lib }}} ",Bugs,closed,To Be Determined,locale,Boost 1.61.0,Problem,invalid,,