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
HP-UX Linker and Libraries User's Guide: HP 9000 Computers > Chapter 5 Creating and Using Libraries

What are Archive Libraries?

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

An archive library contains one or more object files and is created with the ar command. When linking an object file with an archive library, ld searches the library for global definitions that match up with external references in the object file. If a match is found, ld copies the object file containing the global definition from the library into the a.out file. In short, any routines or data a program needs from the library are copied into the resulting a.out file.

NOTE: For 32-bit only:

If the only definition referenced in an object file of an archive library is a common symbol, only that common symbol is copied into the a.out and not the entire object file. This helps reduce the size of the a.out file.

Example

For example, in 32-bit mode, suppose you write a C program that calls printf from the libc library. Figure 5-1 “Linking with an Archive Library ” shows how the resulting a.out file would look if you linked the program with the archive version of libc.

Figure 5-1 Linking with an Archive Library

Linking with an Archive Library
Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1997 Hewlett-Packard Development Company, L.P.