Opened 11 years ago
Closed 11 years ago
#6148 closed Bugs (duplicate)
MinGW : Boost.Thread defaults to DLL linkage
Reported by: | Owned by: | Anthony Williams | |
---|---|---|---|
Milestone: | Component: | thread | |
Version: | Boost 1.48.0 | Severity: | Problem |
Keywords: | MinGW thread static link | Cc: |
Description
I compile boost-1.48 with GCC 4.6.1 using MinGW-32 3.10 on Windows XP.
I confirm the last comment of WFrane in ticket #4614 :
Replying to anthonyw:
Static linking seems to work fine now #4258 is fixed.
It appears that adding #define BOOST_THREAD_USE_LIB 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).
I also built BOOST libraries as static ones (which is the default on MinGW).
Nevertheless, I have to explicitly add -DBOOST_THREAD_USE_LIB to my project makefile to avoid a lot of warnings like :
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]
This is not required on other Win32 platforms.
Now than MinGW has Thread-Local-Storage automatic clean-up (confirmation needed), is it possible to default to static library linkage instead of DLL ?
Change History (2)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Milestone: | To Be Determined |
---|---|
Resolution: | → duplicate |
Status: | new → closed |
I don't know which should be the default, and this must documented. I guess that this could be considered a duplicate of #4921 BOOST_THREAD_USE_DLL and BOOST_THREAD_USE_LIB are crucial and need to be documented
My source on TLS cleanup : http://lists-archives.org/mingw-users/21781-how-best-to-create-multiple-threads-in-mingw.html.
but I do not if they refer to MinGW-32 or MinGW-32/64.