Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
Graphics Administration Guide: HP 9000 Workstations and Servers > Chapter 3 Compiling Your Application

Compiling Starbase Applications

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

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 -Isb-incl -Lcommon-Lsb-lib -lXwindow \

  • -lhpgfx -lXhp11 -lX11 -lm -o example

For FORTRAN:

  • fort77 example.f -Isb-incl -Lcommon -Lsb-lib -lXwindow \

  • -lhpgfx -lXhp11 -lX11 -lm -o example

For Pascal:

  • pc example.p -Isb-incl -Wl,-Lcommon -Wl,-Lsb-lib \

  • -lXwindow -lhpgfx -lXhp11 -lX11 -lm -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 -ldddevice_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".

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.

As of HP-UX 9.05, archive libraries utilize functionality that is included in libXext.a. 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 -Isb-incl -Wl,-a,archive -Lcommon -Lsb-lib \

  • -ldddevice_driver-lXwindow -lhpgfx1 -lhpgfx2 -lXhp11 \

  • -lXext -lX11 -Wl,-E -Wl,+n -l:libdld.sl -lm -o example

For FORTRAN, use:

  • fort77 example.f -Isb-incl -Wl,-a,archive -Lcommon \

  • -Lsb-lib-ldddevice_driver -lXwindow -lhpgfx1 -lhpgfx2 \

  • -lXhp11 -lXext -lX11 -Wl,-E -Wl,+n -l:libdld.sl -lme \

  • -o example

For Pascal, use:

  • pc example.p -Isb-incl -Wl,-a,archive -Wl,-Lcommon \

  • -Wl,-Lsb-lib -ldddevice_driver -lXwindow -lhpgfx1 \

  • -lhpgfx2 -lXhp11 -lXext -lX11 -Wl,-E -Wl,+n \

  • -l:libdld.sl -lm -o example

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1996 Hewlett-Packard Development Company, L.P.