By default, the linker program ld(1) looks for a shared library driver first and then the archive library
driver if a shared library was not found. By using "-Wl,-a,archive" (or exporting the LDOPTS variable),
the -l option will refer only to archive drivers.
Because the archive library libhpgfx1.a references functionality in libXext.a, it is necessary to explicitly
link libXext.a with your program. Otherwise, the linker will have undefined references.
Examples
Assuming you are using ksh(1), to compile and link a C program for use with this driver, use the forms
below.
The "-l:libdld.sl" below specifies the dynamic loader, which is available only in shared-library form.
cc example.c –I<sb-incl> -Wl,-a,archive –L<common> -L<sb-lib> \ -ldd<device_driver> -lXwindow -
lhpgfx1 -lhpgfx2 -lXhp11 \ -lXext -lX11 -Wl,-E -Wl,+n -l:libdld.sl -lm -o example
For FORTRAN, use:
fort77 example.f –I<sb-incl> -Wl,-a,archive –L<common> \ -L<sb-lib>-ldd<device_driver> -
lXwindow -lhpgfx1 -lhpgfx2 \ -lXhp11 -lXext -lX11 -Wl,-E -Wl,+n -l:libdld.sl -lm \ -o example
For Pascal, use:
pc example.p –I<sb-incl> -Wl,-a,archive -Wl,-L<common> \ -Wl,-L<sb-lib> -ldd<device_driver> -
lXwindow -lhpgfx1 \ -lhpgfx2 -lXhp11 -lXext -lX11 -Wl,-E -Wl,+n \ -l:libdld.sl -lm -o example
Compiling HP-PHIGS Applications
Compiling with Shared Libraries
If you are using shared libraries, as we recommend, linking is device-independent. To compile a C
program using shared libraries, you would use the following command:
cc example.c –I<phigs-incl> -L<common>/lib –L<phigs-lib> \-I<phigs-widget>/Motif1.2_R6 -
lXwindow -lphigs -ldl \ -lhpgfx -ldld -lXhp11 -lXi -lXext -lX11 -lm -o example
FORTRAN users can simply replace cc with fort77 in the above command. Also, if you are a
FORTRAN user and prefer using the f77 command, you can replace cc with f77 and change linking
options that are specified as follows:
-L<pathname>
to
-Wl,-L<pathname>
For more information on compiling and linking, read the section "PHIGS PLUS Differences Between
HP-PHIGS 2.2/2.3 and 3.0" in the chapter "Functional Overview" in the HP-PHIGS Graphics
Techniques manual.
Page 15
Graphics Administration Guide for HP-UX 10.20