Help Files: Fortran77: Big Libraries





     HELP                      Sep. 15, 1984               F77/BIGLIBS



               Techniques for Creating Large User Libraries

     If you have a large library, it saves space to strip  the  object
     files  of  local symbols before putting them in the library.  The
     following C shell commands  strip  all  the  '.o'  files  in  the
     current  directory and create a new random library, mylib.a, from
     them.  Do this only with debugged files as the source  level  de-
     buger, dbx, can not be used with stripped object files.

             foreach i (*.o)
                ld -r -x $i
                /bin/mv a.out $i
             end
             /bin/rm -f mylib.a
             ar qv mylib.a *.o
             ranlib mylib.a

     The /bin/rm -f will remove an existing  version  of  the  library
     without  prompting if it exists and without error comment if none
     exists.  'Ar q' is faster than 'ar r' or 'ar u' when creating li-
     braries, especially when creating an archive piece-by-piece.  'q'
     cannot be used when updating an archive.  The 'v'  option  causes
     the  names  of the files being added to be typed on standard out-
     put.

     With large archives, loading time often is improved if the  files
     in  the archive are ordered so that the loader will make only one
     pass through the archive.  To do this, replace the ar by:

             ar qv mylib.a `lorder *.o | tsort`

     If you are creating a archive with over 500 object files, 'lorder
     *.o'  may  cause  the  error:  "Arguments too long".  This can be
     overcome by a sequence such as:

             ar q tmp.a [a-d]*.o
             ar q tmp.a [e-n]*.o
             ar q tmp.a [o-z]*.o
             lorder tmp.a | tsort | split -100 - XXlists
             /bin/rm tmp.a
             foreach i ( XXlists* )
                     ar qv mylib.a `cat $i`
             end
             /bin/rm -f XXlists*

             


Comments to decf@euler.berkeley.edu
© 1998 UC Regents