Next: Skepticism is Healthy
Up: Scientific Subroutine Packages
Previous: The Care and Feeding of a Fortran Subroutine

Compiling and Linking with the Packages

For the example above, suppose the main program is in the file mainimt.f or mainimt.c. Then the Fortran and C procedures are as follows:

   xlf -O mainimt.f -o mainimt -leispackd
   cc -O mainimt.c -o mainimt -leispackd -lxlf
Notice that in the case of the C compilation, it is necessary also to link from the xlf library to include any special Fortran library subprograms called by the EISPACK routines.

The same procedure should be followed for the LINPACK and ESSL libraries. For ESSL you must log on to einstein to carry out the compilation and linking. For IMSL you must log on to newton for compilation, linking, and execution.

To link from the IMSL library requires special treatment, since the names of the routines in the IMSL library all have an underscore character _ stuck after the name. This procedure is supposed to prevent inadvertent clashes between IMSL names and names that you might have chosen for your own subprograms. The procedure for Fortran is this:

   xlf -O main.f -o main -limsl -qextname
In the Fortran case the flag qextname causes the compiler to stick the underscore after every nonstandard subprogram name called from your code. This procedure works fine if your only nonstandard subprograms are taken from the IMSL library. However, if you also have subprograms of your own, they will not be linked properly, since the compiler can't tell the difference between an IMSL program that needs the name change and your subprogram that doesn't. In that case, it is probably better to omit the qextname flag and simply change your code so that the names of all the IMSL routines have the underscore. So if you are calling CSSMH, for example, you should change the name to CSSMH_.

The procedure for C is this:

   cc -O main.c -o main -limsl -lxlf
For the C case you must also alter the name of the IMSL routine in your code. Thus if the documentation says the name is CSSMH, you must use the name cssmh_ everywhere in your code.


Next: Skepticism is Healthy
Up: Scientific Subroutine Packages
Previous: The Care and Feeding of a Fortran Subroutine

Carleton DeTar