Opened 16 years ago
Closed 12 years ago
#802 closed Patches (wontfix)
[thread] MSVS: Allow use of thread headers with /Za
Reported by: | sohail_ | Owned by: | Anthony Williams |
---|---|---|---|
Milestone: | Component: | thread | |
Version: | Boost 1.34.0 | Severity: | Problem |
Keywords: | Cc: |
Description
The following code will not compile if built with /Za on Visual C++ 7.1+: #include <boost/thread/once.hpp> int main(){} It will fail with the following assertion: # error "Threading support unavaliable: it has been explicitly disabled with BOOST_DISABLE_THREADS" The reason is that the Boost.Config machinery realizes that you cannot use the Windows API unless you enable language extensions. As a result, threads cannot be available. This is correct behaviour when you are indeed *using* the Windows API. However, in the above case where you separately compile the threads library, you do not actually use the Windows API => language extensions are not necessary => no need to explicitly specify BOOST_DISABLE_WIN32. I therefore submit that there be some machinery/configuration variables to allow libraries to specify whether or not they require the Windows API. The proposed patch does not modify existing behaviour. That is, if the config machinery decides that the API is needed, it is required, unless explicitly disabled. The code to do this in library xyz would look something like this: #if defined(BOOST_BUILDING_WHATEVER) # define BOOST_NO_REQUIRE_WIN32 #endif #include <boost/config.hpp> I am uncertain of the exact name of the macro that is required but I am certain a macro is required. The attached patch is against 1.33.1. I don't think there is any rush to put this into 1.34. I'm pretty sure it would be nice, but people can manually patch it until 1.35 whenever that is released. Thanks, Sohail
Change History (7)
comment:2 by , 16 years ago
Logged In: YES user_id=1682817 Originator: YES File Added: boost_no_require_win32.patch
comment:3 by , 16 years ago
Logged In: YES user_id=1682817 Originator: YES See also this thread: http://thread.gmane.org/gmane.comp.lib.boost.user/23774/focus=23774 For a discussion that seems to converge on having Boost.Config not touch BOOST_DISABLE_THREADS
comment:4 by , 16 years ago
Logged In: YES user_id=1682817 Originator: YES File Added: 0_boost_building_threads.patch
comment:5 by , 15 years ago
Component: | None → thread |
---|---|
Severity: | → Problem |
comment:6 by , 13 years ago
Version: | None → Boost 1.34.0 |
---|
As Boost.Thread has been redesigned since 1.35 shouldn't this ticket be close if the issue do not appears on with the current release?
comment:7 by , 12 years ago
Resolution: | None → wontfix |
---|---|
Status: | assigned → closed |
As there is no response I close.
Note:
See TracTickets
for help on using tickets.