RFC: Cygwin 64 bit?

Corinna Vinschen corinna-cygwin@cygwin.com
Thu Jan 19 12:13:00 GMT 2012


On Jan 19 11:55, Andy Koppe wrote:
> On 19 January 2012 11:29, Corinna Vinschen wrote:
> > On Jan 19 11:13, Pedro Alves wrote:
> >> Sounds like there's potential for gdb getting confused.
> >>
> >> There's also C++ mangling to consider:
> >>
> >> #pragma model64 (push, LLP64)
> >> void foo (long i);
> >> #pragma model64 (pop)
> >> void foo (long i);
> >> void foo (int i);
> >>
> >> What does the llp64 version mangle to?  If it's auto converted to
> >> int internally, then it conflicts with the int version.  If it's
> >> kept as long, then it conflicts with the lp64 long version.
> >
> > Yes, there is a downside to the concept.  Of course the LLP64 version
> > would collide with one of the LP64 versions.  But is that a realistic
> > problem?  The usage of such a, let's say, dangerous #pragma would be to
> > fix a specific problem.  The idea is to find an easy solution to use the
> > strict LLP64 Win32 headers with an LP64 compiler.  Everything beyond that
> > falls under "you're doing that at your own risk".
> >
> > So far we had four potential ways to tackle this problem in this thread:
> >
> > 1. Use `#ifdef __LP64__' and define as `int' and `unsigned int'
> >   only on LP64 compilers.
> >
> > 2. Change all `long' and `unsigned long' to `int' and `unsigned int'
> >   unconditionally.
> >
> > 3. Add `__attribute__ ((mode(SI)))' to affected typedefs.
> >
> > 4. Introduce a #pragme to redefine long.
> 
> 5. Change uses of 'long' and 'unsigned long' to 'LONG' and 'ULONG',
> and define the latter two as 'int' and 'unsigned int' for __LP64__.
> (Most of the w32api headers use the uppercase typedefs anyway; shame
> MS didn't manage to be entirely consistent about that.)

Yep, that would be a solution as well.  It could be combined with a
new header file which is included by all other windows headers,
along the lines of

  $ cat _win_long_type.h
  #ifdef __LP64__
    typedef int LONG, *PLONG, *LPLONG;
    typedef unsigned int ULONG, *PULONG *LPULONG;
    typedef unsigned int DWORD, *PDWORD *LPDWORD;
  #else
    typedef long LONG, *PLONG, *LPLONG;
    typedef unsigned long ULONG, *PULONG *LPULONG;
    typedef unsigned long DWORD, *PDWORD *LPDWORD;
  #endif


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