[Info-vax] Architecture specific code in VMS Fortran
Joseph Huber
joseph.huber at NOREPLY.web.de
Sun Oct 2 14:33:50 EDT 2011
Tom Wade wrote:
> Hello,
>
> I've checked out the HP Fortran manuals for compiler directives in code
> that can select based on the
> architecture (VAX/Alpha/IA64). It seems the CDEC$ IF DEFINED stuff is the
> way to go, but although it describes how to define and test variables, I
> can't see a list of predefined variables such as
> the current architecture. I want to do something like
>
> CDEC$ IF DEFINED (VAX)
>
> <code to be compiled only if on VAX>
> CDEC$ ENDIF
>
Since I also found no way to do it, I'm used to use standard C preprocessor
directives for conditional compilation.
Then either use C/COMMENTS=AS_IS/NOLINE_DIRECTIVES/PREPROC=fortranoutputfile
or
the Sun studio FPP Fortran preprocessor
(see
http://developers.sun.com/sunstudio/products/previous/fortran/whitepapers/wp-
fpp/index.html or download from http://www.netlib.org/fortran/).
For my use I added some predefined macros in init.c like
#ifdef __VMS
dodef2("__VMS","1",1);
#endif
#ifdef __vax
dodef2("__vax","1",1);
#endif
#ifdef __alpha
dodef2("__alpha","1",1);
#endif
Using standard preprocessor has the advantage of making source files working
with u*x compiler suites like gfortran.
--
Joseph Huber - http://www.huber-joseph.de
More information about the Info-vax
mailing list