64 bit Cygwin target and _WIN64

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Jul 19 08:49:00 GMT 2012

On Jul 19 02:32, Charles Wilson wrote:
> On 7/18/2012 7:03 AM, Corinna Vinschen wrote:
> >3. In a core Mingw64 header:
> >
> >     #ifdef __CYGWIN64__
> >     #define _WIN64
> >     #endif
> This is basically what happens with _WIN32 and WIN32, right now, and
> the existing w32api headers (see windef.h).  (And, when you talk of

Oh boy!  Would you believe that I didn't know that?  Since WIN32 and
friends are defined by the (mingw or cygwin with -mwin32) compiler, I
never searched the w32api headers for that definition.

That does not happen in the Mingw64 headers, they don't... erm...

[...time passes...]

...they do, kind of.  _WIN32 is only defined by the compiler, but
WIN32 (no underscore) in ole2.h.  Interesting.

> "Mingw64 headers" with regards to how a cygwin compiler would use
> them, you /must/ be talking about that portion of mingw64 that is
> "w32api-like" and not the parts that are "mingw-runtime-like"
> correct?)

Of course.  We're exclusively taking about the PSDK portion of
the Mingw64 headers and libs, plus a handful of CRT headers which
are required to make the PSDK headers work.

> So, I really don't see that this is any different than the current
> situation: if you #include any w32api headers, you need to be
> careful in your own code about #ifdef _WIN32, and guard it with &&
> !defined(__CYGWIN__) unless you want those windows-isms -- and as
> good practice and for clarity, amplify with || defined(__CYGWIN__)
> if you really want those windows-isms, just so some well-meaning
> chap doesn't come along and "fix" it for you later.
> I *wish* there was a better way, but at least this is no worse than
> status quo, wrt the current w32api headers.

Thanks, that was an important point.  And a lesson to look *first* in
the headers before claiming something about what they do and not do.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-developers mailing list