64 bit Cygwin target and _WIN64

Christopher Faylor cgf-use-the-mailinglist-please@cygwin.com
Wed Jul 18 15:00:00 GMT 2012

On Wed, Jul 18, 2012 at 04:42:02PM +0200, Corinna Vinschen wrote:
>On Jul 18 09:44, Christopher Faylor wrote:
>> On Wed, Jul 18, 2012 at 02:55:41PM +0200, Corinna Vinschen wrote:
>> >On Jul 18 08:36, Earnie Boyd wrote:
>> >> On Wed, Jul 18, 2012 at 7:03 AM, Corinna Vinschen wrote:
>> >> > Now comes the time for _WIN64.  _WIN64 is used a *LOT* inside of the
>> >> > Mingw64 headers to distinguish type definitions which differ from the
>> >> > 32 bit version, or to declare functions which only exist on 64 bit
>> >> > machines, stuff like that.
>> >> 
>> >> Is it needed always or just during compilation of Cygwin? (but read on
>> >> before answering)
>> >
>> >The _WIN64 define is needed for building Cygwin as well as for building
>> >Cygwin applications accessing the Windows API.
>> Why would we worry about hypothetical nonexistent people who are trying
>> to build a 64-bit Cygwin app with 64-bit Windows headers?  Couldn't we
>It's hypothetical at this point, but it's not hypothetical as soon as
>the first Cygwin/Windows mixed application is supposed to be ported to
>64 bit Cygwin.  The problem with _WIN64 is not that it will be used
>inside of an application, but that it is used inside the Windows headers,
>for instance to create different structure layouts depending on running
>on 32 or 64 bit Windows.  Typical example, just one of many:
>  #if defined(_WIN64)
>    typedef struct DECLSPEC_ALIGN(16) _SLIST_HEADER {
>      ULONGLONG Alignment;
>      ULONGLONG Region;
>    typedef struct _SLIST_HEADER *PSLIST_HEADER;
>  #else
>    typedef union _SLIST_HEADER {
>      ULONGLONG Alignment;
>      __C89_NAMELESS struct {
>        SLIST_ENTRY Next;
>        WORD Depth;
>        WORD Sequence;
>  #endif

Right.  Didn't you already explain this?  This is certainly what I would
expect the headers to look like.

>> just tell them "Define _WIN64_ somewhere if you want to do this" ?  And
>> then we could use -D_WIN64_ on the Cygwin command line.
>> I think making this somewhat hard might actually help clarify that, when
>> building an app, Cygwin should not be conflated with Windows.
>Why do you want to make life harder for Andy or Jon or Yaakov?  Mintty
>or the X server are valid applications which we're happy to exist while
>they having a perfectly good reason to include Windows headers.

This is hardly difficult.  They will have two different versions to
compile.  They can define _WIN64 if they want the 64-bit variant.  This
will be the least of anyone's worries if they are porting code from
32-bit to 64-bit Windows.

I really don't see why the Mingw64 project should have to accommodate
Cygwin.  Maybe if we put a #define _WIN64 in a Cygwin header, I'd feel
slightly better about this but I don't see why another project should
have to change to accommodate us.  Should they also have defines for
Wine and ReactOS?  That doesn't seem like the right way to go.


More information about the Cygwin-developers mailing list