Modify

Ticket #802 (closed Patches: wontfix)

Opened 7 years ago

Last modified 3 years ago

[thread] MSVS: Allow use of thread headers with /Za

Reported by: sohail_ Owned by: anthonyw
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

Attachments

Change History

comment:1 Changed 7 years ago by sohail_

Logged In: YES 
user_id=1682817
Originator: YES

That should be:

#if !defined(BOOST_BUILDING_WHATEVER)

:)

comment:2 Changed 7 years ago by sohail_

Logged In: YES 
user_id=1682817
Originator: YES

File Added: boost_no_require_win32.patch

comment:3 Changed 7 years ago by sohail_

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 Changed 7 years ago by sohail_

Logged In: YES 
user_id=1682817
Originator: YES

File Added: 0_boost_building_threads.patch

comment:5 Changed 7 years ago by anthonyw

  • Component changed from None to thread
  • Severity set to Problem

comment:6 Changed 4 years ago by viboes

  • Version changed from None to 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 Changed 3 years ago by viboes

  • Status changed from assigned to closed
  • Resolution changed from None to wontfix

As there is no response I close.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.