HP (Hewlett-Packard) HP-UX Time Clock User Manual


 
Chapter 2: Compiling Your Application
This chapter provides information for compiling your application with either archived or shared libraries
for the following Application Programming Interfaces (APIs): Starbase, HP-PHIGS, and HP PEX.
Compiling examples are given for C, Fortran, and Pascal.
The actual pathnames of the conceptual (<italicized and angle-bracketed>) directory names in this
chapter depends on the file system structure. See
Chapter 1 for details.
Compiling Starbase Applications
Compiling with Shared Libraries
The compiler programs (cc, f77, and pc) link with Starbase shared libraries by default. Starbase will
explicitly load the appropriate device driver library at run time when you compile and link with the
shared library <common> /lib/libhpgfx.sl, or use the -lhpgfx option. This loading occurs at gopen(3G)
time.
Examples
Assuming you are using ksh(1), to compile and link a C program for use with the shared library driver,
use the forms below.
cc example.c –I<sb-incl> -L<common> -L<sb-lib> -lXwindow \ -lhpgfx -lXhp11 -lX11 -lm -ldld -o
example
For FORTRAN:
fort77 example.f –I<sb-incl> -L<common> -L<sb-lib> -lXwindow \ -lhpgfx -lXhp11 -lX11 -lm -ldld -o
example
For Pascal:
pc example.p –I<sb-incl> -Wl,-L<common> -Wl,-L<sb-lib> \ -lXwindow -lhpgfx -lXhp11 -lX11 -lm -
ldld -o example
Compiling with Archive Libraries
You can link the appropriate library, for your specific device driver, to a program by using any one of
the following:
The path name <sb-lib>/<library_name>.a;
An appropriate relative path name; or
The –ldd<device_driver> option (for example, -lddhcrx) with the LDOPTS environment
variable set to -a archive and exported. Or (preferred because of fewer side-effects), "-Wl,-
a,archive".
Graphics Administration Guide for HP-UX 10.20
Page 14