[Boost-bugs] [Boost C++ Libraries] #13077: Linking to static 64bit libboost_thread fails DLL initialization

Subject: [Boost-bugs] [Boost C++ Libraries] #13077: Linking to static 64bit libboost_thread fails DLL initialization
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2017-06-16 08:14:20


#13077: Linking to static 64bit libboost_thread fails DLL initialization
-------------------------------------------+-------------------------
 Reporter: Teemu Ikonen <teemu.ikonen@…> | Owner: anthonyw
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: thread
  Version: Boost 1.63.0 | Severity: Showstopper
 Keywords: |
-------------------------------------------+-------------------------
 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

--
Ticket URL: <https://svn.boost.org/trac10/boost/ticket/13077>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-06-16 08:17:55 UTC