### 6 Compiling and Linking with MSG and ERR

There are five Fortran include files available for use with the Message and Error System: SAE_PAR, MSG_PAR, MSG_ERR, ERR_PAR and ERR_ERR. (See Appendix A for details of the symbolic constants which they define).

The Starlink convention is that the name in upper case with no path or extension is specified when including these files within Fortran code, e.g.

*  Global Constants:
INCLUDE ’SAE_PAR’
INCLUDE ’MSG_PAR’

Equivalent header files are provided for use in C code which is calling MSG or ERR – all the required header files, including the function prototypes, may be included by including the file mers.h.

The syntax

#include "sae_par.h"
#include "mers.h"

should be used within the C code.

Assuming that the software has been installed in the standard way and /star/bin has been added to the environment variable PATH, soft links with these upper-case names pointing to the required file are set up in the user’s working directory by the the commands:

% star_dev
% err_dev

The ADAM version of MSG/ERR is included automatically when programs are linked using the ADAM application linking commands, alink etc. These will handle either Fortran or C code.

To compile and link a non-ADAM program with the stand-alone version of MSG/ERR, the command line would be, e.g.

% f77 -o program program.f -L/star/lib ‘err_link‘

On platforms with shareable libraries, -L/star/lib might be replaced by -L/star/share.

If it is necessary to link explicitly with the ADAM version of MSG/ERR and any libraries which it uses (e.g. to produce a shareable library), the script err_link_adam is available in /star/bin. The link command might be: