The link_ana command is used to link Analysis_Control programs. If invoked
interactively it will prompt for input, however it's most common use is in
command procedures or scipts, in which case it has the following usage:
$ LINK_ANA MYEXE_NAME MYOPT_FILE [Yes/No/All] <optional_library_list>
(for VMS systems)
% link_ana myexe_name.exe myopt_file.opt [no/all/user/O2] <optional_library> (for UNIX systems)
The first argument is the name of the exe, the second is the name of the options file (note that the file extensions must be specified on UNIX systems) and the last required parameter is a keyword indicating the level of debugging desired. Keyword values are:
The primary input for the link_ana command is the options file. On VMS systems an options file is a list of object files or libraries that the user wishes to link. The names of object files should be separated by commas and a minus sign should appear at the end of each line apart from the last. If libraries are included in an options file, the qualifier /LIB should follow the library name. On UNIX systems the options file has no special meaning to the system and is just a file that the link_ana script parses. Therefor the only requirement is that the entries should be space or <new line> separated. You may specify any file that the f77 command will accept. The f77 command accepts *.f, *.o, *.dlb and *.olb files as input. You may also specify f77 or ld option flags. For example -v added to this file will produce a verbose linker listing. If you want to use an ld option you must tell f77 that it is a linker flag by prefacing it with ``-Wl,''. For example -Wl,-U tells the linker to make an exe even if there are undefined symbols. Other useful options are: -ysymbol which specifies that symbol be traced, and -Wl,-u,symbol which says declare symbol as undefined before any libraries are searched. Do a ``man ld'' and ``man f77'' for complete information about option flags. Input file specifications and option flags must be separated by a space. You may use environmental variables.
Link_ana also uses optional DCL symbols and logicals/environmental variables.
On VMS if the symbol MAPFILE points to a file link_ana will create a
linker map file. For example:
$ MAPFILE :== MYSCR:MYJOB.MAP
$ LINK_ANA ...
On UNIX if the environmental variable MAPFILE points to a file link_ana
will create the closest thing UNIX has to a map file. For example:
% setenv MAPFILE $MYSCR/myjob.map
% link_ana ...
On VMS if the logical OFFLINK_OPT points to a private offline options file it will be used instead of the standard one. On UNIX if the environmental variable OFFLINE_OPT is set, it's value will be used instead of the default offline options file. On UNIX if the shift product is setup link_ana will link to the shift version of the cern libraries. SHIFT software is used by the silo staging system. However if NO_CERN_SHIFT is defined link_ana will remove the use of the shift libraries even if they are available. Finally if the environmental variable A_C_MAIN_PROG is set it's value will be used as the main object file instead of anmain.o. This is used by some programs that want to link to the offline but don't want the A_C main, for example df.
The most common problem with both the VMS and SGI linkers is leaving undefined symbols. These linkers are single pass, so it is possible that a routine may be in a library but there are recursive references in your link which cause the symbol to be left undefined. First try to see which routine needs the missing symbol. On VMS this information is automatically generated, on SGIs use the -ysymbol flag in your options file. (symbol is the symbol name that is missing. Case is significant and you must use the ``_'' if it is a fortran routine.) Then find out if the routine really exists or not. On FNALD and cdfsga there is a command ``locs'' which will search the known libraries for the missing routine. If the routine doesn't exist ask the person who maintains the routine that needs it. If it does then you have a link order problem. You could experiment around by making a copy of the default offline options file and moving the libraries around until the problem goes away but, probably the fastest way to solve the problem is to use the -Wl,-u,symbol option. On VMS the equilalent solution is to add something like C$XXX:XXXLIB/include=symbol to the user options file.