[Info-vax] Architecture specific code in VMS Fortran (summary)
Tom Wade
nospam at tomwade.eu
Thu Oct 13 11:54:18 EDT 2011
Thanks for all who responded to this query.
In summary, the If Defined (alpha) and If Defined (IA64) work fine as long as you have Fortran 8.2.
Unfortunately there doesn't seem to be any version of the Fortran compiler for VAX which will
recognize the If Defined (VAX) which renders this mechanism somewhat useless.
The approach I will take is to locate architecture specific modules in alternative files, and modify
the BUILD.COM file that does the compilation so as to select a machine specific file during the
compilation phase if it exists.
Something like:
$ arch = F$Getsyi ("arch_name")
$...
$ Call Compile Fortran FOOBLE FOR
$...
$Compile: Subroutine
$ compiler = p1
$ name = p2
$ extension = p3
$
$ If F$Search ("''name'-''arch'.''extension'") .eqs. ""
$ Then
$ file = name
$ Else
$ file = "''name'-''arch'"
$ EndIf
$
$ 'Compiler' 'file' /object='name'
$ Exit
which will generate FOOBLE.OBJ from FOOBLE-VAX.FOR, FOOBLE-ALPHA.FOR or FOOBLE-IA64.FOR if they
exist, or FOOBLE.FOR if it does not. That way I can create -VAX/-ALPHA/-IA64 versions of only those
modules that need them.
Once again, thanks for the many suggestions.
Tom Wade
More information about the Info-vax
mailing list