From: noer AT cygnus DOT com (Geoffrey Noer) Subject: Re: I: gcc ... -U_WIN32 ... may cause problems 1 Sep 1998 03:42:38 -0700 Message-ID: <19980831155303.40141.cygnus.gnu-win32@cygnus.com> References: <199808300406 DOT WAA01030 AT tuffy DOT reversion DOT ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii To: Craig Nelson Cc: gnu-win32 AT cygnus DOT com 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 AT cygnus DOT com - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".