[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Performance Management Guide


Examples

Following is an example that illustrates efficient use of the ld command:

  1. To prebind a library, use the following command on the archive file:

    # ld -r libfoo.a -o libfooa.o
    
  2. The compile and bind of the FORTRAN program something.f is as follows:

    # xlf something.f libfooa.o
    

    Notice that the prebound library is treated as another ordinary input file, not with the usual library identification syntax (-lfoo).

  3. To recompile the module and rebind the executable program after fixing a bug, use the following:

    # xlf something.f a.out
    
  4. However, if the bug fix had resulted in a call to a different subroutine in the library, the bind would fail. The following Korn shell script tests for a failure return code and recovers:

    # !/usr/bin/ksh
    # Shell script for source file replacement bind
    #
    xlf something.f a.out
    rc=$?
    if [ "$rc" != 0 ]
    then
    echo "New function added ... using libfooa.o"
    xlf something.o libfooa.o
    fi
    


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]