Compilation error in boost::bind

The documentation for __stdcall in MSVC says the following: On Itanium Processor Family (IPF) and x64 processors, __stdcall is accepted and ignored by the compiler. Because of this, the following fragment from <boost/bind/bind.hpp> fails when causes build errors for either of these platforms: #define BOOST_BIND_CC #define BOOST_BIND_ST #include <boost/bind/bind_cc.hpp> #undef BOOST_BIND_CC #undef BOOST_BIND_ST #ifdef BOOST_BIND_ENABLE_STDCALL #define BOOST_BIND_CC __stdcall #define BOOST_BIND_ST #include <boost/bind/bind_cc.hpp> #undef BOOST_BIND_CC #undef BOOST_BIND_ST #endif Since it ignores the __stdcall the second time around, all the templates are re-declared with cdecl causing duplicate symbol definition errors. This is confirmed on MSVC 9.0 but I assume it exists on all versions of MSVC. What is the best way to fix this? I don't know much about how to use the BOOST_WORKAROUND macros, but I have patched this in my own version of bind.hpp by changing the block inside the ifdef to the following: #if defined(BOOST_BIND_ENABLE_STDCALL) && !(defined(BOOST_MSVC) && defined(_WIN64)) #define BOOST_BIND_CC __stdcall #define BOOST_BIND_ST #include <boost/bind/bind_cc.hpp> #undef BOOST_BIND_CC #undef BOOST_BIND_ST #endif This doesn't handle the itanium case obviously but off the top of my head I'm not sure what MSVC #defines for itanium. What would be the most robust way to fix this?

On Jun 17, 2009, at 11:27 AM, Zachary Turner wrote:
The documentation for __stdcall in MSVC says the following:
On Itanium Processor Family (IPF) and x64 processors, __stdcall is accepted and ignored by the compiler.
"Accepted and ignored" - that's a new phrase for them. A long time ago, MS used "implemented syntacticly but not semantically" in a similar situation ;-)

Zachary Turner:
The documentation for __stdcall in MSVC says the following:
On Itanium Processor Family (IPF) and x64 processors, __stdcall is accepted and ignored by the compiler.
Because of this, the following fragment from <boost/bind/bind.hpp> fails when causes build errors for either of these platforms:
...
What would be the most robust way to fix this?
Not defining BOOST_BIND_ENABLE_STDCALL on x64?
participants (3)
-
Marshall Clow
-
Peter Dimov
-
Zachary Turner