On Fri, Apr 12, 2013 at 11:49 PM, Dave Korn <dave.korn.cyg...@gmail.com> wrote: > On 12/04/2013 19:47, Janne Blomqvist wrote: > >> As I don't have a Windows system to test on, I would appreciate if somebody >> more familiar with that platform could take a quick look. In particular, I >> *think* it should be Ok to use win32 API functions on Cygwin (that is, >> cygwin-gcc ships the windows.h and other necessary headers out of the >> box?), > > Well, after installing the w32api package, but basically yes, that's fine > for simple stuff like that. (You shouldn't go doing things like creating > threads or synchronisation through the Win32 API, but calling GetTickCount[64] > will be fine.)
Ok, thanks. >> and that _WIN32 is the correct macro to use to select code which is common >> to MinGW and Cygwin. > > Alas no: > >> $ gcc-4 -E - < /dev/null -dM | grep WIN >> #define __WINT_MAX__ 4294967295U >> #define __WINT_MIN__ 0U >> #define __SIZEOF_WINT_T__ 4 >> #define __CYGWIN__ 1 >> #define __WINT_TYPE__ unsigned int >> #define __CYGWIN32__ 1 > > You should probably use "#if defined(__MINGW32__) || defined (__CYGWIN__)", > since that'll also work on 64-bit Cygwin, as opposed to using __CYGWIN32__. I > think __MINGW32__ is defined for 64-bit as well as 32-bit targets. Ok, I'll do that. Thanks for the info. FWIW, I grepped through the gcc tree and there's quite a lot of #if defined(_WIN32) && !defined(__CYGWIN__) and similar, which in the light of the above, is pointless. And yes, I also recall that mingw-w64 also defines __MINGW32__. -- Janne Blomqvist