7 Compiling and Linking

 7.1 Unix
 7.2 VMS

7.1 Unix

On a Unix system, the FORTRAN compiler will only look for include files in the directory that contains the source code of the program being compiled unless the include file is given as an explicit path name. Consequently, the best way of naming include files on a Unix system is to use soft links. For example, the program contains lines such as:

        INCLUDE ’SAE_PAR’

and you create a soft link in your directory with the command:

  % ln -s /star/include/sae_par SAE_PAR

A shell script called fio_dev is provided to create the appropriate soft links for the FIO library.

To compile and link a program that uses FIO, type:

  % f77 prog.f -L/star/lib ‘fio_link‘

To compile and link an ADAM program that uses FIO, type:

  % alink prog.f ‘fio_link_adam‘

7.2 VMS

The current version of FIO/RIO is distributed as a shareable image. Before compiling a program that uses any of the FIO include files, or linking any program that uses FIO, type

  $ FIO_DEV

The FIO shareable image is included in the STAR_LINK shareable image library, so the preferred method of linking basic FORTRAN programs is:

  $ LINK progname,STAR_LINK/OPT

To link an ADAM program with FIO, type:

  $ ALINK progname

The shareable libraries and object libraries are stored in FIO_DIR, so if you need to link explicitly with the shareable library, type:

  $ LINK progname,FIO_LINK/OPT

or to link with the object library, type:

  $ LINK progname,FIO\_DIR:FIO/LIB

Linking with the object library is not recommended as it makes the size of executable files larger than using shareable libraries and it will require relinking programs to take advantage of bug fixes or updates.