Menu

#397 winuser.h: MsgWaitForMultipleObjects is hidden behind #ifndef NOGDI

v1.0 (example)
closed
None
5
2014-09-28
2014-05-16
No

Unlike MSVC and MinGW, MinGW-W64 version of winuser.h hides MsgWaitForMultipleObjects behind #ifndef NOGDI.

This causes unwanted MinGW-W64-only workarounds in software that wants to compile under MinGW-W64.

For full story, please see relevant thread in git mailing list:
http://git.661346.n2.nabble.com/PATCH-v2-MinGW-W64-cross-compilation-tp7609085p7609093.html

Besides MsgWaitForMultipleObjects itself, also these should be moved out from #ifndef NOGDI:
1. MsgWaitForMultipleObjectsEx
2. QS_* defines

Discussion

  • Tom Honermann

    Tom Honermann - 2014-09-26

    I just encountered this problem using a MinGW-w64 gcc 4.8.2 build. Here is a simple test case:

    $ gcc --version
    gcc.exe (i686-win32-dwarf, Built by MinGW-W64 project) 4.8.2
    Copyright (C) 2013 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions. There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

    $ cat t.c

    #ifndef NONOGDI
    #define NOGDI
    #endif
    #include <windows.h>
    
    int main() {
        WCHAR wsz[] = L"x";
        CharUpperW(wsz);
    }
    

    $ gcc t.c -o t -luser32
    C:\cygwin\tmp\ccwZcPpJ.o:t.c:(.text+0x1f): undefined reference to `CharUpperW'
    collect2.exe: error: ld returned 1 exit status
    $ echo $?
    1

    $ gcc -DNONOGDI t.c -o t -luser32
    $ echo $?
    0

     

    Last edit: Tom Honermann 2014-09-26
  • Jonathan Yong

    Jonathan Yong - 2014-09-28
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,3 @@
    -
     Unlike MSVC and MinGW, MinGW-W64 version of winuser.h hides MsgWaitForMultipleObjects behind #ifndef NOGDI.
    
     This causes unwanted MinGW-W64-only workarounds in software that wants to compile under MinGW-W64.
    
    • status: open --> closed
    • assigned_to: Jonathan Yong
     
  • Jonathan Yong

    Jonathan Yong - 2014-09-28

    Done, backported the master copy into v3.x.

     

Log in to post a comment.