NAG Fortran Library : Dependencies of Executables
This note shows you how to use standard Unix tools to list dependencies of executables on the NAG Fortran or SMP Library. In particular this note looks at how to find NAG Fortran or SMP Library dependencies in static linked executables. Although the techniques described below refer specifically to the NAG Fortran Library, the expressions may be adapted to find other NAG library dependencies.
The Tools
1. nm
The standard Unix tool nm prints the name list of an object file or executable. This produces a verbose list of the symbol table of the object or executable file.Please note that nm will not find any symbol table in an executable that has been stripped and hence will not list any routine names.
2. grep
What is then needed is a tool to search for NAG Library names amongst the verbose output of nm. The pattern matching tool grep can do this for us.All user callable NAG Fortran Library routines have names of the form:
Letter (0, 1 or 2) Number Letter Letter FIn grep this is represented by the regular expression:[A-Z][0-2][0-9][A-Z][A-Z]FNote that even if the NAG routine is called using a BLAS name, the NAG name will be in the symbol table too.
The Unix Command
If our executable program is called a.out, the Unix command to search for NAG Library dependencies is:The above concepts were tested on a Sun workstation running Solaris, but most Unix systems will have similar facilities, and produced the following output