64 bit Cygwin target and _WIN64

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


On Jul 18 15:11, Yaakov (Cygwin/X) wrote:
> On 2012-07-18 06:47, Corinna Vinschen wrote:
> >On Jul 18 06:17, Yaakov (Cygwin/X) wrote:
> >>On 2012-07-18 06:03, Corinna Vinschen wrote:
> >>>1. Replace all
> >>>
> >>>     #ifdef _WIN64
> >>>
> >>>    with
> >>>
> >>>     #if defined (_WIN64) || defined (__CYGWIN64__)
> >>
> >>Can't that just be #ifdef __x86_64__?
> >
> >Nope.  Think Itanium.
> 
> Oh, right, I forgot about Itanium.  Hmm, I wonder why? :-)
> 
> >>Also, I would suggest avoiding __CYGWIN64__:  IIRC we used to use
> >>__CYGWIN32__ until M$ trademarked "Win32", leaving us with just
> >>__CYGWIN__;  what happens if they decide to trademark "Win64"?
> >
> >I don't see the issue here.  Cygwin is also a trademark and 32 bitg
> >gcc still defines __CYGWIN32__.  We just discouraged the use of it.
> >I think the __CYGWIN__ and __CYGWIN32__ defines on 32 bit and the
> >__CYGWIN__ and __CYGWIN64__ defines on a 64 bit system make sense
> >and are an easy way to distinguish the platforms.
> 
> BTW, __CYGWIN32__ will still be defined on x64, right?

I have a preliminary toolchain (just tools, nothing else) created by a
collegue of mine.  We discussed this briefly and right now it only
defines __CYGWIN__ and __CYGWIN64__.

Since we deprecated __CYGWIN32__ long ago, it didn't seem prudent to
define it for the 64 bit target, but this early in the game I'm open for
discussion.

There *may* still be projects out in the wild which test for
__CYGWIN32__, so it could be a good idea to define __CYGWIN32__ on 64
bit as well...

> >>>4. Let the Cygwin 64 bit gcc define _WIN64 by default.
> >>
> >>No way, for the same reason we don't define _WIN32.
> >
> >But what about 2 and 3?
> 
> AFAICS 3 is the status quo; iff you #include <windows.h>, you get
> _WIN32 (and have to deal with the consequences), otherwise not.

No, that's not correct.  _WIN32, together with its friends WIN32,
__WIN32, and __WIN32__, are defined by the compiler.  A Mingw32 or
Mingw64 compiler defines trhem by default, a Cygwin compiler only
defines them if you use the -mwin32 option.

A 64 bit targeting Mingw64 compiler also defines it's WIN64 cousins.
A 64 bit Cygwin compiler may or may not add the -mwin32 option and,
if so, will do the same.

> That's worked pretty well so far, so let's stick with it.

Corinna

-- 
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