Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#1380 winbase.h: 'Interlocked' API functions incorrectly declared

closed-fixed
Earnie Boyd
2012-08-01
2009-12-20
Anonymous
No

Mingw tools installed and setup with the latest stable download mingw-5.1.6.exe.
When building STLPort 5.2.1 Test units, the following compilation errors occur:

.../winbase.h:1667: error: declaration of C function
`LONG InterlockedDecrement(LONG*)' conflicts with
.../_windows.h:167: error: previous declaration
`long int InterlockedDecrement(volatile long int*)' here

.../winbase.h:: error: declaration of C function
`LONG InterlockedIncrement(LONG*)' conflicts with
.../_windows.h:: error: previous declaration
`long int InterlockedIncrement(volatile long int*)' here

.../winbase.h:: error: declaration of C function
`LONG InterlockedExchange(LONG*)' conflicts with
.../_windows.h:: error: previous declaration
`long int InterlockedExchange(volatile long int*)' here

From the Mingw mailing list, Keith pointed out that the error is due to non-conforming calling convention for some of the functions in winbase.h used by mingw as it relates to MSDN.

Keith quote:

"Looks like *some* of the Increment* function prototypes have been
incorrectly declared in w32api's winbase.h; (MSDN says some should
be __cdecl, but w32api declares all as WINAPI, (i.e. __stdcall))."

Discussion

  • Keith Marshall
    Keith Marshall
    2009-12-21

    • summary: Cannot build STLPort Test units --> winbase.h: 'Interlocked' API functions incorrectly declared
     
  • Keith Marshall
    Keith Marshall
    2009-12-21

    In fact, MSDN says that *all* of the 'Interlocked' API functions which are declared in w32api's winbase.h should be declared with the `__cdecl' attribute, *except* for the three which appeared in WinXP, which are correctly declared.

     
  • Keith Marshall
    Keith Marshall
    2010-01-25

    • assigned_to: nobody --> ir0nh34d
     
  • Earnie Boyd
    Earnie Boyd
    2012-08-01

    The problem you report has caused modification in some fashion in
    the official CVS for the given package. The w32api and
    mingw-runtime official CVS reside in the winsup CVS directory tree for Cygwin. If you still find problems then please open a
    new report.

     
  • Earnie Boyd
    Earnie Boyd
    2012-08-01

    • assigned_to: ir0nh34d --> earnie
    • status: open --> closed-fixed
     
  • Earnie Boyd
    Earnie Boyd
    2012-08-10

    The patch for this was reverted because kernel32.dll itself exports these as __stdcall requiring the @BYTE indicator in the library definitions.