Boost C++ Libraries: Ticket #6148: MinGW : Boost.Thread defaults to DLL linkage https://svn.boost.org/trac10/ticket/6148 <p> I compile boost-1.48 with GCC 4.6.1 using MinGW-32 3.10 on Windows XP. </p> <p> I confirm the last comment of <strong>WFrane</strong> in ticket <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4614" title="#4614: Bugs: Unable to statically link thread lib on mingw/win32 (closed: fixed)">#4614</a> : </p> <blockquote class="citation"> <p> Replying to <strong>anthonyw</strong>: </p> <blockquote class="citation"> <p> Static linking seems to work fine now <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4258" title="#4258: Bugs: Linking with boost thread does not work on mingw/gcc 4.5 (closed: fixed)">#4258</a> is fixed. </p> </blockquote> <p> It appears that adding <strong>#define BOOST_THREAD_USE_LIB</strong> before other boost thread-related preprocessor directives is still required for static linking when using MinGW (tested using Boost 1.45.0 and MinGW 4.4.1). </p> </blockquote> <p> I also built BOOST libraries as static ones (which is the default on MinGW). </p> <p> Nevertheless, I have to explicitly add <strong>-DBOOST_THREAD_USE_LIB</strong> to my project makefile to avoid a lot of warnings like : </p> <pre class="wiki">boost-1.48/thread/win32/thread_heap_alloc.hpp:59:40: warning: inline function 'void* boost::detail::allocate_raw_heap_memory(unsigned int)' declared as dllimport: attribute ignored [-Wattributes] boost-1.48/thread/win32/thread_heap_alloc.hpp:69:39: warning: inline function 'void boost::detail::free_raw_heap_memory(void*)' declared as dllimport: attribute ignored [-Wattributes] </pre><p> This is not required on other Win32 platforms. </p> <p> Now than MinGW has Thread-Local-Storage automatic clean-up (<em>confirmation needed</em>), is it possible to default to static library linkage instead of DLL ? </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6148 Trac 1.4.3 Cyril Othenin-Girard <cog@…> Sat, 19 Nov 2011 11:36:38 GMT <link>https://svn.boost.org/trac10/ticket/6148#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/6148#comment:1</guid> <description> <p> My source on TLS cleanup : <a class="ext-link" href="http://lists-archives.org/mingw-users/21781-how-best-to-create-multiple-threads-in-mingw.html"><span class="icon">​</span>http://lists-archives.org/mingw-users/21781-how-best-to-create-multiple-threads-in-mingw.html</a>. </p> <blockquote class="citation"> <p> ... because our (mingw.org) native thread cleanup code now employs TLS too ... </p> </blockquote> <p> but I do not if they refer to MinGW-32 or MinGW-32/64. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>viboes</dc:creator> <pubDate>Sun, 11 Dec 2011 09:49:39 GMT</pubDate> <title>status changed; resolution set; milestone deleted https://svn.boost.org/trac10/ticket/6148#comment:2 https://svn.boost.org/trac10/ticket/6148#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">duplicate</span> </li> <li><strong>milestone</strong> <span class="trac-field-deleted">To Be Determined</span> </li> </ul> <p> I don't know which should be the default, and this must documented. I guess that this could be considered a duplicate of <a class="closed ticket" href="https://svn.boost.org/trac10/ticket/4921" title="#4921: Bugs: BOOST_THREAD_USE_DLL and BOOST_THREAD_USE_LIB are crucial and need to ... (closed: fixed)">#4921</a> BOOST_THREAD_USE_DLL and BOOST_THREAD_USE_LIB are crucial and need to be documented </p> Ticket