www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/21/23:14:08

From: "John M. Aldrich" <fighteer AT NO DOT SPAM DOT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: dos/unix defines
Date: Mon, 21 Apr 1997 08:40:39 +0000
Organization: Two pounds of chaos and a pinch of salt
Lines: 23
Message-ID: <335B2807.2636@NO.SPAM.cs.com>
References: <Pine DOT SUN DOT 3 DOT 95 DOT 970421155639 DOT 26004A-100000 AT bert DOT eecs DOT uic DOT edu>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp108.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Andrew Deren wrote:
> 
> Does anyone know what #define I have to use to detect whether a program is
> compiled on DOS or UNIX. I use Borland C++ and DJGPP for DOS and gcc and
> CC for unix if that matters.

You can pass the '-E -dM' parameters to gcc to see only a list of the
preprocessor macros that are defined when you compile your programs.

To detect Unix, use #ifdef(unix).
To detect MS-DOS, use #ifdef(MSDOS).
To detect DJGPP, use #ifdef(DJGPP).
To detect GNU C, use #ifdef(__GNUC__).

On some compilers (such as DJGPP), both 'unix' and 'MSDOS' will be
defined due to the nature of the compiler.

-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I |     mailto:fighteer AT cs DOT com      |
| Proud owner of what might one   |   http://www.cs.com/fighteer    |
| day be a spectacular MUD...     | Plan: To make Bill Gates suffer |
---------------------------------------------------------------------

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019