[Info-vax] Architecture specific code in VMS Fortran
Craig A. Berry
craigberry at nospam.mac.com
Mon Oct 3 23:09:37 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
>
> Any small examples ?
The following seems to work with Fortran v8.2 on Itanium but not with
Fortran v7.1-1 on Alpha (which won't even compile the CDEC$ business).
Hard to say without more testing what the minimum version and
architecture are.
$ type archname.for
Program ARCHNAME
CDEC$ IF DEFINED (IA64)
Type *, "IA64"
CDEC$ ELSE IF DEFINED (ALPHA)
Type *, "ALPHA"
CDEC$ ELSE IF DEFINED (VAX)
Type *, "VAX"
CDEC$ ELSE
Type *, "Unknown architecture"
CDEC$ ENDIF
End
$ for archname
$ link archname
$ r archname
IA64
$ for/vers
HP Fortran V8.2-104939-50H96
More information about the Info-vax
mailing list