HPlogo HP C/HP-UX Release Notes for HP-UX 11.01: HP 9000 Computers > Chapter 1 New and Changed Features

Shared library performance improvements

» 

Technical documentation

Complete book in PDF

 » Table of Contents

Beginning with HP-UX 11.0, users were not allowed to mix shared and archive libraries. This resulted in a slight increase in function overhead, particularly when routine system function calls were required. The libcres.a archive library has been added to the HP C runtime compiler to reduce this overhead.

Libcres.a is a small archive library that contains standard C routines such as string, memory, and other key functions (described in Table 1-3 “libcres.a symbols” below). The intent of this library is to provide performance-critical applications with the benefit of static linkage to commonly used libc functions. Libcres.a is built using a high level of optimization (+O3) with the HP C optimizing compiler.

NOTE: There is no functionality impact on applications that use libcres.a.

Libcres.a contains only "leaf functions", i.e., functions that do not call any other functions. Any performance improvement is highly dependent on the application's use of these included functions.

The following symbols are contained in libcres.a:

Table 1-3 libcres.a symbols

libc symbols in libcres.aDescription
abs()return integer absolute value
bsearch()binary search a sorted table
div()integer division and remainder
ffs()find first set bit (BSD)
insque()insert an element in a queue
labs()return long integer absolute value
ldiv()long integer division and remainder
memchr()find first occurrence of byte in memory region
memcmp()compare contents of two memory regions
memcpy()copy memory region to a non-overlapping region
memmove()copy memory region to a possibly overlapping region
memset()fill a memory region with a specified byte
qsort()execute quicker sort
strcat()append string number 2 to string number 1
strchr()get pointer to character in string
strcmp()compare two strings
strcpy()copy string number 2 to string number 1
strcspn()find length of matching substrings
strlen()determine length of string
strncat()append string number 2 to string number 1 (up to a given maximum length)
strncmp()compare two strings (up to a given maximum length)
strncpy()copy string number 2 to string number 1 (up to a given maximum length)
strrchr()get pointer to character in string
strspn()find length of matching substring
strstr()finds a substring in a string
swab()swap bytes

 

How to use libcres.a

In order to make use of libcres.a, existing makefiles must be modified to include it when linking. Existing applications must also be re-linked in order to make use of libcres.a. The modules of this library are compiled with the HP-UX C compiler using the +O3 optimization flag.

The functions in this library can not be overridden with a user-defined function of the same name, as is the case today with other libc function names.

CAUTION: If you use libcres.a, your other libraries must not contain functions of the same name. Otherwise, unexpected results may occur.
© Hewlett-Packard Development Company, L.P.