Node and Host Name Sizes on HP-UX: Using the Expanded Capabilities of HP-UX

29
Note that only exported or referenced scalar and structure names appear in the object’s linker symbol
table. By tagging the exported or referenced data with the version identifier, the linker ensures that
objects bind to the desired data format.
Type and structure definitions do not appear in the symbol table, but the ability to apply a version
identifier is important, as described in the next section.
Transitive API Changes and Inheritance
Consider the following structure, which defines a common data header:
struct std_hdr {
int hdr_identifier;
size_t hdr_data_size;
time_t hdr_creationtime;
time_t hdr_lastmodifytime;
};
It is included at the beginning of other structures, such as the following:
struct ds_a { struct_ds_b {
struct std_hdr a_hdr; struct std_hdr b_hdr;
int a_field1; int b_field1;
int a_field2; int b_field2;
} }
Finally, these structures are used in some exported function interfaces:
int fetch_ds_a(char *name, struct ds_a *dsap);
int fetch_ds_b(int cmd, struct ds_b *dsbp);
int fetch_hdr(struct std_hdr *hdrp);
As an example, assume the above declarations have been previously exported. However, now the
definition of std_hdr needs to change in order to accommodate a new field (for example, a new
time_t hdr_lastaccesstime field). Because std_hdr is used in other data structure definitions
and functions, those definitions and interfaces must also change. The change is said to be transitive.
That is, the change propagates from that structure into function interfaces that include that structure,
into other structures that include that structure, into function interfaces that include those other
structures, and so on. A change in one structure can affect many interfaces.
The FLV mechanisms provide version inheritance. Given a modified type (which is tagged with a
version attribute), the version identifier is propagated to any interface that uses the modified type.
This avoids the need to explicitly add version attributes to every declaration and definition in the
affected interfaces.
The following are detailed rules for version inheritance:
For a structure or union, if one or more of its members have attached version identifiers, the compiler
determines which of these version identifiers is lexically greatest. It records this high-water mark in its
internal symbol table entry for the newly declared structure or union. For C++ classes, the compiler
considers the base classes, nonstatic data members, and virtual member functions, but not static data
members, static member functions, or nonvirtual member functions.