id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 13077,Linking to static 64bit libboost_thread fails DLL initialization,Teemu Ikonen ,viboes,"If DLL links to static boost thread library the dll can not initialize and any exe that uses the DLL fails with error code ```(0xc0000142) 'DLL Initialization Failed'```. I've attached an minimal example project to demonstrate the problem. The package includes static boost libraries that were built with steps given below. This example produces a thedll.dll that links libboost_thread (does not use any headers) and then theexe.exe that links to thedll.dll. theexe.exe fails to start with attached error prompt. Root cause of the fail is beyond me, but I traced debugger to dll_dllmain.cpp on line 57. Here _initterm_e returns non-zero value and thedll.dll init fails. ```This happens only if libboost_thread is linked to the dll```. Environment: * Visual Studio 15 2017 Community Edition * 64 bit builds. * CMake generator 'Visual Studio 15 2017 Win64'. Boost build steps: (Called from VS environment cmd shell. Tools -> Visual Studio Command Prompt) 1. C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat amd64 1. bootstrap.bat 1. bjam -j4 architecture=x86 address-model=64 link=static stage 1. bjam --prefix=C:\opt\boost architecture=x86 address-model=64 link=static install",Bugs,closed,Boost 1.65.0,thread,Boost 1.63.0,Showstopper,fixed,,