6 Creating and Using Libraries

Many libraries come with HP-UX. You can also create and use your own libraries on HP-UX. This chapter discusses the following topics:

General Information About Shared and Archive Libraries

“Overview of Shared and Archive Libraries” (page 89)

“What are Archive Libraries?” (page 90)

“What are Shared Libraries?” (page 91)

“Example Program Comparing Shared and Archive Libraries” (page 92)

“Shared Libraries with Debuggers, Profilers, and Static Analysis” (page 94)

Creating Libraries on HP-UX

“Creating Archive Libraries” (page 94)

“Creating Shared Libraries” (page 98)

Using Libraries on HP-UX

“Version Control with Shared Libraries” (page 110)

“Switching from Archive to Shared Libraries” (page 115)

“Summary of HP-UX Libraries” (page 117)

“Caution When Mixing Shared and Archive Libraries” (page 118)

“Using Shared Libraries in Default Mode” (page 124)

“Internal Name Processing” (page 125)

“Dynamic Path Searching for Shared Libraries” (page 126)

“Shared Library Symbol Binding Semantics” (page 126)

“Mixed Mode Shared Libraries” (page 130)

“IPF Library Examples” (page 131)

Overview of Shared and Archive Libraries

HP-UX supports two kinds of libraries: archive and shared. A shared library is also called a dll (dynamically linked library). Archive libraries are the more traditional of the two, but use of shared libraries has increased dramatically, and is the preferred method. The following table summarizes differences between archive and shared libraries.

Table 20 Differences between archive and shared libraries

Comparing

Archive

Shared (or dll)

file name suffix

Suffix is .a.

Suffix is .sl or .<version> on PA systems and .so or

 

 

.so.<version> on Itanium-based systems, where version is the

 

 

version number of the library.

creation

Combine object files with the ar

Combine object files with the ld command

 

command

 

Overview of Shared and Archive Libraries 89

Page 89
Image 89
HP UX Software Transition Kit (STK) manual Overview of Shared and Archive Libraries, Creating Libraries on HP-UX