Modify

Ticket #5431 (closed Bugs: fixed)

Opened 3 years ago

Last modified 12 months ago

compile error in Windows CE 6.0(interlocked)

Reported by: Akira Takahashi <faithandbrave@…> Owned by: viboes
Milestone: Boost 1.52.0 Component: thread
Version: Boost 1.46.1 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 3 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 3 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 3 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 2 years ago by viboes

  • Keywords CE interlocked added

comment:5 Changed 2 years ago by viboes

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

comment:6 Changed 2 years ago by anonymous

  • Keywords wince added; CE removed

comment:7 follow-up: ↓ 9 Changed 22 months 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 22 months 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 20 months 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 20 months ago by viboes

  • Milestone changed from To Be Determined to Boost 1.52.0

Committed in trunk revision 80042.

comment:11 Changed 20 months ago by viboes

  • Milestone changed from Boost 1.52.0 to To Be Determined

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

  • Milestone changed from To Be Determined to Boost 1.52.0

Committed in trunk revision [80127].

Last edited 20 months ago by viboes (previous) (diff)

comment:14 Changed 19 months ago by viboes

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

Merged from trunk [80473].

comment:15 Changed 12 months 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 12 months 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 12 months ago by anonymous

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

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.