I: gcc ... -U_WIN32 ... may cause problems

Geoffrey Noer noer@cygnus.com
Mon Aug 31 15:55:00 GMT 1998


On Sat, Aug 29, 1998 at 10:06:06PM -0600, Craig Nelson wrote:
[...]
> What purpose does defining _WIN32 serve in a CYGWIN32 environment?  Isn't 
> CYGWIN32 supposed to make our UNIX code think it's still on a UNIX box?
> 
> I have libraries that can be compiled with MSV++ or on UNIX, and I like
> the option of being able to use either environment for use on windows (via
> CYGWIN32) but I have to #ifdef code to do that.  IMHO, it would be
> nice to get rid of the _WIN32 definition here if its not really needed.
> 
> What's the Cygnus position on this?

Hmmmm...

The scheme we've been using here is to use:

     _WIN32 to indicate availability of the Win32 API.
     _MSC_VER to indicate MSVC-specific code.
     __CYGWIN32__ to indicate cygwin-specific code.

As I've mentioned before, we will be moving to a single gcc
configuration that generates either Mingw *or* Cygwin32-linked code, a
configuration called "i586-win32" (which can itself be either Mingw or
Cygwin32-based).  The preliminary/not-well-tested version of this will
be included as part of the upcoming EGCS 1.1 release.

Looking at its specs file (see gcc/config/i386/win32.h once EGCS 1.1
is released), -mcygwin as a compile-time flag defines __CYGWIN32__,
otherwise __MINGW32__ is defined.  Either way _WIN32 is defined.

Perhaps -Dunix should be added to the define list whenever
__CYGWIN32__ is defined?  Linux includes -Dunix and -Asystem(posix) in
CPP_PREDEFINES (looking at gcc/config/i386/linux.h).

-- 
Geoffrey Noer
noer@cygnus.com
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list