HP Visualize c240se hp workstations - hp-ux 10.20 graphics administration guid - Page 15
Examples, Compiling HP-PHIGS Applications, Compiling with Shared Libraries
View all HP Visualize c240se manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 15 highlights
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 -Wl,-a,archive -L -L \ -ldd -lXwindow lhpgfx1 -lhpgfx2 -lXhp11 \ -lXext -lX11 -Wl,-E -Wl,+n -l:libdld.sl -lm -o example For FORTRAN, use: fort77 example.f -I -Wl,-a,archive -L \ -L-ldd lXwindow -lhpgfx1 -lhpgfx2 \ -lXhp11 -lXext -lX11 -Wl,-E -Wl,+n -l:libdld.sl -lm \ -o example For Pascal, use: pc example.p -I -Wl,-a,archive -Wl,-L \ -Wl,-L -ldd 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 -L/lib -L \-I/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 to -Wl,-L 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