cpp compatiblity Unix/VMS

Keith Moore moore at utkcs2.cs.utk.edu
Fri Aug 5 22:20:14 AEST 1988


In article <134 at iquery.UUCP>, matt at iquery.UUCP (Matt Reedy) writes:
> The problem is the following:  I want the same source to compile on both
> SysV and VMS, so I use this style:
> 
> #ifdef VAX
> #include file
> #include stdio
> #else
> #include <fcntl.h>
> #include <stdio.h>
> #endif
> 
> On the VAX, the '#include file' and '#include stdio' syntax is valid and
> references members of a text library.  However, my 3B2 cpp chokes on these
> lines with 'bad include syntax' even though the symbol VAX is NOT DEFINED.
> 
> Is there an easy workaround?
Sure.  Just use
#ifdef vms
#include <file.h>
#include <stdio.h>
#else
...
for VMS also.  The VMS systems I have seen put copies of these files in 
sys$library:, and the C compiler knows to search for include files there.
This may be an option, however.  At worst, you can extract them from
sys$library:vaxcdef.tlb with the LIBRARY command, as in:

$ lib/extract=file sys$library:vaxcdef.tlb
$ rename vaxcdef.txt file.h

...and use the #include "filename" syntax, or the /INCLUDE= command line
qualifier.

BTW, you might prefer to use #ifdef vms rather than #ifdef VAX.
*Some* VAXen run a different operating system. :-)

...embarassed that I know this much about the VMS C compiler...
Keith Moore
UT Computer Science Dept.	Internet/CSnet: moore at utkcs2.cs.utk.edu
107 Ayres Hall, UT Campus	BITNET: moore at utkcs1
Knoxville Tennessee 37996-1301	Telephone: +1 615 974 0822
-- 
Keith Moore
UT Computer Science Dept.	Internet/CSnet: moore at utkcs2.cs.utk.edu
107 Ayres Hall, UT Campus	BITNET: moore at utkcs1
Knoxville Tennessee 37996-1301	Telephone: +1 615 974 0822



More information about the Comp.lang.c mailing list