Modify

Ticket #5431 (new Bugs)

Opened 4 years ago

Last modified 12 months ago

compile error in Windows CE 6.0(interlocked)

Reported by: Akira Takahashi <faithandbrave@…> Owned by: pdimov
Milestone: To Be Determined 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

Attachments

Change History

comment:1 Changed 4 years ago by Akira Takahashi <faithandbrave@…>

sorry, after code is follow:

#elif defined(_WIN32_WCE)

# 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

comment:2 Changed 4 years ago by viboes

  • Cc viboes 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 Changed 4 years ago by faithandbrave@…

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

  • Keywords CE interlocked added

comment:5 Changed 4 years ago by viboes

  • Owner changed from anthonyw to viboes
  • Status changed from new to assigned

comment:6 Changed 4 years ago by anonymous

  • Keywords wince added; CE removed

comment:7 follow-up: ↓ 9 Changed 3 years ago by 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?

comment:8 Changed 3 years ago by Akira Takahashi <faithandbrave@…>

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 in reply to: ↑ 7 Changed 3 years ago by mboard182@…

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

  • Milestone changed from To Be Determined to Boost 1.52.0

Committed in trunk revision 80042.

comment:11 Changed 3 years ago by viboes

  • Milestone changed from Boost 1.52.0 to To Be Determined

comment:12 Changed 3 years ago by viboes

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

  • Milestone changed from To Be Determined to Boost 1.52.0

Committed in trunk revision [80127].

Last edited 3 years ago by viboes (previous) (diff)

comment:14 Changed 3 years ago by viboes

  • Status changed from assigned to closed
  • Resolution set to fixed

Merged from trunk [80473].

comment:15 Changed 2 years ago by Martin.problemboost.Maurer@…

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

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

Similar error under Vista, VS2008, 64 bit compiler:  https://svn.boost.org/trac/boost/ticket/8485

comment:18 Changed 16 months ago by christian.vollmer@…

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 Changed 16 months ago by anonymous

  • Status changed from closed to reopened
  • Resolution fixed deleted

comment:20 Changed 15 months ago by viboes

  • Version changed from Boost 1.46.1 to Boost 1.55.0
  • Milestone changed from Boost 1.52.0 to To Be Determined

comment:21 Changed 15 months ago by viboes

  • Owner changed from viboes to pdimov
  • Status changed from reopened to new
  • Component changed from thread to None

Peter please, could you take a look at this issue?

comment:22 Changed 15 months ago by pdimov

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 Changed 12 months ago by viboes

  • Component changed from None to winapi
View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as new
Author


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

 
Note: See TracTickets for help on using tickets.