* Global Constants: INCLUDE 'SAE_PAR' INCLUDE 'EMS_PAR'
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 Fortran include files are set up in the user's working directory by the commands:
% star_dev % ems_dev
Equivalent header files are installed in -I/star/include for use in C code which is calling EMS - they are named sae_par.h, ems_par.h and ems_err.h. In addition, ems.h contains the function prototypes for each of the C functions. The syntax
should be used within the C code, and the compiler option -I/star/include used.#include "sae_par.h" #include "ems.h"
The Error Message Service is included automatically when programs are linked using the ADAM application linking commands, alink etc.
To link a non-ADAM Fortran program with the the Error Message Service, the command line would be:
On platforms with shareable libraries, -L/star/lib might be replaced by -L/star/share.% f77 program.o -L/star/lib `ems_link` -o program.out
If it is necessary to link explicitly with the ADAM version of EMS and any libraries which it uses (e.g. to produce a shareable library), the script ems_link_adam is available in /star/bin. The link command might be:
(In fact, ems_link and ems_link_adam are now functionally identical.)% ld -shared -o libmypkg.so.1.0 -L/star/share -lmypkg `ems_link_adam`
The command to compile and link a C program might be:
% cc -o program -I/star/include -L/star/lib program.c `ems_link`
Note that the command used to invoke the C compiler varies from one UNIX implementation to another (indeed, there may be more than one C compiler available on the same machine) - you should therefore check this with your Site Manager before proceeding.
If the C program makes no use of the EMS Fortran interface, the `ems_link` command may be changed to `ems_link Conly`. This will avoid the linker looking for the Starlink CNF library, which may not be present at a non-Starlink site.
EMS Error Message Service