NAG Logo
Numerical Algorithms Group

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 F
In grep this is represented by the regular expression:
[A-Z][0-2][0-9][A-Z][A-Z]F
Note 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:
    nm a.out | grep -i '[a-z][0-2][0-9][a-z][a-z]f'
The -i option tells grep to ignore case in its regular expression comparisons (and may not be needed if the loader converts all external names to lower case).

The above concepts were tested on a Sun workstation running Solaris, but most Unix systems will have similar facilities, and produced the following output

    [108] | 68480| 32|FUNC |GLOB |0 |8 |f06jlf_
showing that the NAG routine F06JLF was called (even though its BLAS name IDAMAX was used in the calling program).
© The Numerical Algorithms Group 2008
Privacy Policy | Trademarks

© Numerical Algorithms Group

Visit NAG on the web at:

www.nag.co.uk (Europe and ROW)
www.nag.com (North America)
www.nag-j.co.jp (Japan)

http://www.nag.com/numeric/FL/FL_dependency.asp