3 Program Development – INCLUDE files

If the Infrastructure library you want to use has INCLUDE files, you need to be able to reference them from your source code.

You might wish to use the full PATH name for the INCLUDE file, e.g., /star/include/bly_par. This is fine, and works, but is not portable, and could lead to problems if you want to use a development version of the library.

The recommended way to use the INCLUDE files for a particular library is to create links in your development directory to the INCLUDE files, and reference the links in your source code.

A library ‘dev’ script will create the links for you in your working directory. The links are UPPER-CASE, and it is these upper-case links you reference in the source code, thus:

        PROGRAM MYPROG
  *
  *  demonstrate use of include file
  *
        INCLUDE ’BLY_PAR’
  *
        ...
  *
        END

To generate the links, issue the development command:

  % bly_dev

This will create links to ALL the INCLUDE files for the BLY library:

  BLY_ERR ->  /star/include/bly_err
  BLY_PAR ->  /star/include/bly_par

To remove the links, issue the command again with the remove option:

  % bly_dev remove

You should keep the links in place while developing your program. If you want to move development directories, simply remove the links and create new ones in the new directory.

The Starlink software building system uses the soft link strategy in its makefiles, though the makefiles generate the links themselves. The links may easily be changed to pick up a development version of a library, without having to edit source code.