Download CERN UNIX User Guide

Transcript
you can specify the full pathname of the library just as you would with your object files .o
files. For example;f77 mprog.f mysub.o /cern/pro/lib/libpacklib.a
Or you can specify the library with a combination of the -L and -l options, e.g. -L/cern/
pro/lib -lpacklib which refers to the CERNLIB library packlib. What this actually is
instructing the link editor to do is to search the directory (search path) /cern/pro/lib
for the library libpacklib.a which will then be replaced on the command line with /
cern/pro/lib/libpacklib.a which you could type in yourself.
fort77 +ppu -O -o my_program my_program.f\
-L/usr/local/delphi/dpadev/lib -ltanag3xx\
-L/cern/pro/lib -lgraf
lib -lgrafX11 -lpacklib
NOTE that the placement of a library on the command line is important (as it also is for the
VAX/VMS LINK command); the libraries are searched once only, in the order they appear on
the command line.
7.4.1
The cernlib command
The cernlib command has been designed to ease access to the CERN program library software, while allowing access to user libraries. It is platform-independent and accepts the
POSIX syntax. Note that you must have the directory /cern/pro/bin in your path in
order to use this command.
cernlib
grants access to packlib
cernlib mathlib
grants access to mathlib and packlib
cernlib -L $DELPHI_LIBS -l dstanaxx -l ux26xx
grants access to libraries dstanaxx and ux26xx in the directory
defined by the environment variable DELPHI_LIBS
The cernlib command is used in combination with the link command by enclosing it in
back-quotes on the link command line. For example if you use the f77 command for linking:
f77 -o
...‘
7.5
myprog
myprog.o
‘cernlib
mathlib
graf
Compiling and Linking Options
The compiling and linking options are given together on the same command line.
• Executable program:
-c Instructs the compiler to suppress the link edit phase and produce only a file containing
the object code that results from the compilation. This file can then be linked into another
program or placed in a library.
-o f ilenameSets the name of the output file containing the executable program to
f ilename.
• Optimization:
64
lib/X11