Gary F Mitchell
May 1999
Starlink User Note 15.7 D L Terrett 12 May 1997but we have PGPLOT installed in /opt/pgplot and not in /star. nevertheless the documentation of the library is the same.
gfm@cs1> f77 -L /opt/pgplot -lpgplotThe -L flag is followed by a directory name eg /opt/pgplot. The -l flag is followed by the name of a library file in that directory - but with the 3 characters "lib" removed from the name of the file. (see "Details on Linking" below if you're want to understand what these are).
gfm@cs1> gfm1The example program creates a PostScript file which can be examined by any PostScript interpreter eg the sdtimage application from CDE. Of course many more devices are supported by the PGPLOT drawing library eg X-window.
-rw-r--r-- 1 root other 79832 May 14 15:06 /opt/pgplot/libcpgplot.a -rw-r--r-- 1 root other 776824 May 14 14:58 /opt/pgplot/libpgplot.a -rwxr-xr-x 1 root other 503364 May 14 14:58 /opt/pgplot/libpgplot.soThe file libcpgplot.a is for C programs. The file libpgplot.a is an archive of object files. You can examine it's contents using the ar command
gfm@cs1> ar -t /opt/pgplot/libpgplot.a figdisp_comm.o gidriv.o grarea.o grbpic.o grchsz.o ... ... vadriv.o wddriv.o x2driv.o xwdriv.oThe file libpgplot.so is a shared object library. It has the same content as the archive file but in a different form.
When you link the program you either do a static link or a dynamic link.
The option static vs dynamic is controlled by a flag to the compiler such as -Bdynamic or -Bstatic or -dy -dn. The default is to attempt a dynamic link but resort to static if there is no shared obsject library file.
The recommendation of CFG is to accept the system default and have a dynamic link.
f77 -flagsFor a really quick intro to flags for libraries use grep
f77 -flags | grep lib
file:/opt/SUNWspro/DOC4.0/lib/locale/C/html_docs/index.html
PGPLOT --- Graphics Subroutine Library
("file:/star/docs/sun15.htx/sun15.html")
This page is available on-line at http://www.ing.iac.es/~cfg/notes/pub_notes/pgplot/