boost/thread/once.hpp - problem with boost::call_once() on MSVC++ on AMD64

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

boost/thread/once.hpp - problem with boost::call_once() on MSVC++ on AMD64

Bill Somerville (unix)
Hi

I'm having trouble linking a program that uses boost::call_once() on  
a Windows AMD64 machine.

I get a link error saying _InterlockedCompareExchange() is undefined  
- this should be an intrinsic function on this platform but I think  
the code in thread/src/once.cpp where the address is taken of the  
intrinsic function has fooled the development system. It works OK on  
IA64 were the function is also intrinsic.

We are building statically so it's possible that we are not passing  
some compiler switch that fixes this - but I don't see it.

Has anyone else hit this problem with 64-bit AMD64 code and  
boost::call_once() on Windows?

Compiler version is: Microsoft (R) C/C++ Optimizing Compiler Version  
14.00.40121 for AMD64

Bill Somerville

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: boost/thread/once.hpp - problem with boost::call_once() on MSVC++ on AMD64

Bill Somerville (unix)
More info on this one:

I tried commenting out the compare_exchange() fn and the forwarding  
fns it uses and switched to directly calling  
InterlockedExchangeCompare() in boost/thread/src/once.cpp and this  
fixed the problem. I also see the error in a vanilla boost build for  
AMD64 Windows - has anyone tested this code on 64-bit Windows?

I suppose it's a compiler bug as (although I'm not completely sure)  
it knows that the address of the fn is only used in inline fns that  
call it. Also it seems to compile OK on the IA64 compiler without  
this change.

Bill Somerville

On 20 Mar 2006, at 16:15, Bill Somerville wrote:

Hi

I'm having trouble linking a program that uses boost::call_once() on
a Windows AMD64 machine.

I get a link error saying _InterlockedCompareExchange() is undefined
- this should be an intrinsic function on this platform but I think
the code in thread/src/once.cpp where the address is taken of the
intrinsic function has fooled the development system. It works OK on
IA64 were the function is also intrinsic.

We are building statically so it's possible that we are not passing
some compiler switch that fixes this - but I don't see it.

Has anyone else hit this problem with 64-bit AMD64 code and
boost::call_once() on Windows?

Compiler version is: Microsoft (R) C/C++ Optimizing Compiler Version
14.00.40121 for AMD64

Bill Somerville

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users