Opened 12 years ago
Closed 5 years ago
#5431 closed Bugs (fixed)
compile error in Windows CE 6.0(interlocked)
Reported by: | Owned by: | James E. King, III | |
---|---|---|---|
Milestone: | Boost 1.66.0 | Component: | winapi |
Version: | Boost 1.55.0 | Severity: | Problem |
Keywords: | wince interlocked | Cc: | viboes |
Description
boost/detail/interlocked.hpp is compile error in Windows CE platform.
error C2733 : second C linkage of overloaded function 'InterlockedXXX' not allowed
I correct follow change:
before
#elif defined(_WIN32_WCE) // under Windows CE we still have old-style Interlocked* functions extern "C" long __cdecl InterlockedIncrement( long* ); extern "C" long __cdecl InterlockedDecrement( long* ); extern "C" long __cdecl InterlockedCompareExchange( long*, long, long ); extern "C" long __cdecl InterlockedExchange( long*, long ); extern "C" long __cdecl InterlockedExchangeAdd( long*, long ); # define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement # define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement # define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange # define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange # define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd
after:
# define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement # define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement # define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange # define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange # define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd
Change History (26)
comment:1 by , 12 years ago
comment:2 by , 11 years ago
Cc: | added |
---|
Which boost library is including the detail/interlocked.hpp file?
Could you send the declarations of the InterlockedXXX functions you have on your WindowsCE platform and the version?
comment:3 by , 11 years ago
detail/interlocked.hpp used by Boost.Thread. include place is boost/thread/win32/interlocked_read.hpp.
WindowsCE Version $(CEVER) is defined as 0x600.
_WIN32_WCE=$(CEVER)
InterlockedXXX function declaration is follow:
winbase.h
#ifdef __cplusplus extern "C" { #endif ... #ifdef MIPS_R4000 /* or above */ ... #elif defined(_X86_) ... #else // not _X86_ LONG WINAPI InterlockedIncrement( LONG volatile *lpAddend ); LONG WINAPI InterlockedDecrement( LONG volatile *lpAddend ); LONG WINAPI InterlockedExchange( LONG volatile *Target, LONG Value ); LONG WINAPI InterlockedCompareExchange( LONG volatile *Target, LONG Exchange, LONG Comperand ); LONG WINAPI InterlockedExchangeAdd( LONG volatile *lpAddend, LONG Value ); #define InterlockedTestExchange(Target, oldValue, newValue) \ InterlockedCompareExchange((Target), (newValue), (oldValue)) #endif ... #ifdef __cplusplus } #endif
comment:4 by , 11 years ago
Keywords: | CE interlocked added |
---|
comment:5 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:6 by , 11 years ago
Keywords: | wince added; CE removed |
---|
follow-up: 9 comment:7 by , 10 years ago
Could changing the declarations to
extern "C" long __cdecl InterlockedIncrement( long volatile * ); extern "C" long __cdecl InterlockedDecrement( long volatile * ); extern "C" long __cdecl InterlockedCompareExchange( long volatile *, long, long ); extern "C" long __cdecl InterlockedExchange( long volatile *, long ); extern "C" long __cdecl InterlockedExchangeAdd( long volatile *, long );
solve also the issue?
comment:8 by , 10 years ago
I think that change is OK. But unfortunately, I have already left from the Windows CE platform. I can't test this change.
comment:9 by , 10 years ago
Replying to viboes:
Could changing the declarations to
extern "C" long __cdecl InterlockedIncrement( long volatile * ); extern "C" long __cdecl InterlockedDecrement( long volatile * ); extern "C" long __cdecl InterlockedCompareExchange( long volatile *, long, long ); extern "C" long __cdecl InterlockedExchange( long volatile *, long ); extern "C" long __cdecl InterlockedExchangeAdd( long volatile *, long );solve also the issue?
Yes, this appears to solve the link error. Can you help me understand why??
AFAIK with 'extern "C"', the following have the same name (and indeed will not link for me on vc9.0/winCE6 arm)
void foo(int *i){...} void foo(volatile int *i){...}
comment:10 by , 10 years ago
Milestone: | To Be Determined → Boost 1.52.0 |
---|
Committed in trunk revision 80042.
comment:11 by , 10 years ago
Milestone: | Boost 1.52.0 → To Be Determined |
---|
comment:12 by , 10 years ago
last update rolledback as it make regression test fail. Committed in trunk revision [80067]. I will try making the modification only when _WIN32_WCE==0x600.
comment:13 by , 10 years ago
Milestone: | To Be Determined → Boost 1.52.0 |
---|
Committed in trunk revision [80127].
comment:14 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Merged from trunk [80473].
comment:15 by , 10 years ago
I got the same error under Windows Vista, Visual Studio Express 2008, using 64 bit compiler and intrin.h my in own program. Same situation with boost 1.51.0 and 1.53.0 Could be because the above bugfix seems to be activated only for Windows CE, but i have Vista not Windows CE. Any idea?
comment:16 by , 10 years ago
Please, create a new ticket as even if your problem is related it is for a different platform. Could you tell me which macro characterize your platform? If you could provide a patch this would help a lot.
comment:17 by , 9 years ago
Similar error under Vista, VS2008, 64 bit compiler: https://svn.boost.org/trac/boost/ticket/8485
comment:18 by , 8 years ago
I got the same problem with the same platform but for the current boost version of 1.55. However, commenting out the section that handled the special case for _WIN32_WCE >= 0x600 solved the issue. Now the code looks like this:
//#if _WIN32_WCE >= 0x600 // //extern "C" long __cdecl _InterlockedIncrement( long volatile * ); //extern "C" long __cdecl _InterlockedDecrement( long volatile * ); //extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long ); //extern "C" long __cdecl _InterlockedExchange( long volatile *, long ); //extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long ); // //# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement //# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement //# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange //# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange //# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd // //#else // under Windows CE we still have old-style Interlocked* functions //extern "C" long __cdecl InterlockedIncrement( long* ); //extern "C" long __cdecl InterlockedDecrement( long* ); //extern "C" long __cdecl InterlockedCompareExchange( long*, long, long ); //extern "C" long __cdecl InterlockedExchange( long*, long ); //extern "C" long __cdecl InterlockedExchangeAdd( long*, long ); # define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement # define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement # define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange # define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange # define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd //#endif
comment:19 by , 8 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:20 by , 8 years ago
Milestone: | Boost 1.52.0 → To Be Determined |
---|---|
Version: | Boost 1.46.1 → Boost 1.55.0 |
comment:21 by , 8 years ago
Component: | thread → None |
---|---|
Owner: | changed from | to
Status: | reopened → new |
Peter please, could you take a look at this issue?
comment:22 by , 8 years ago
I don't have access to any Windows CE platform, so I'm not sure what I can contribute. I don't even understand what problem is being discussed here.
comment:23 by , 8 years ago
Component: | None → winapi |
---|
comment:24 by , 5 years ago
Milestone: | To Be Determined → Boost 1.66.0 |
---|---|
Owner: | changed from | to
comment:26 by , 5 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I've committed the fix in https://github.com/boostorg/winapi/commit/e5a59445bfe3f8f5f6077d1e7b4d5d91a02a10af. I'm not able to test the change and would appreciate if anyone here is able to try it.
sorry, after code is follow: