DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
C and C++ compilation system

Guidelines for building shared objects

This topic gives coding guidelines and maintenance tips for shared library development. Before getting down to specifics, we should emphasize that if you plan to develop a commercial shared library, you ought to consider providing a compatible archive as well. As noted previously, some users may not find a shared library appropriate for their applications. Others may want their applications to run on UNIX® operating system releases without shared object support. Shared object code is completely compatible with archive library code. You can use the same source files to build archive and shared object versions of a library. Some of the reasons you might want to use shared objects are:

To enhance shared library performance, you should:

  1. Minimize the Library's Data Segment

  2. Minimize Paging Activity.

Minimize the library's data segment.

As noted, only a shared object's text segment is shared by all processes that use it; its data segment typically is not. Every process that uses a shared object usually gets a private memory copy of its entire data segment, regardless of how much data is needed. You can cut down the size of the data segment in several ways:

Minimize paging activity.

Although processes that use shared libraries will not write to shared pages, they still may incur page faults. To the extent they do, their performance will degrade. You can minimize paging activity in the following ways:


Next topic: Library maintenance
Previous topic: Dynamic linking programming interface

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004