ELF Library Functions elfversion(3ELF)
NAME
elfversion - coordinate ELF library and application ver-
sions
SYNOPSIS
cc [ flag ... ] file ... -lelf [ library ... ]
#include
unsigned elfversion(unsigned ver);
DESCRIPTION
As elf(3ELF) explains, the program, the library, and an
object file have independent notions of the latest ELF ver-
sion. elfversion() lets a program query the ELF library's
internal version. It further lets the program specify what
memory types it uses by giving its own working version, ver,
to the library. Every program that uses the ELF library must
coordinate versions as described below.
The header supplies the version to the program
with the macro EVCURENT. If the library's internal version
(the highest version known to the library) is lower than
that known by the program itself, the library may lack
semantic knowledge assumed by the program. Accordingly,
elfversion() will not accept a working version unknown to
the library.
Passing ver equal to EVNONE causes elfversion() to return
the library's internal version, without altering the working
version. If ver is a version known to the library,
elfversion() returns the previous (or initial) working ver-
sion number. Otherwise, the working version remains
unchanged and elfversion() returns EVNONE.
EXAMPLES
Example 1 A sample display of using the elfversion() func-
tion.
The following excerpt from an application program protects
itself from using an older library:
if (elfversion(EVCURENT) == EVNONE) {
/* library out of date */
/* recover from error */
}
SunOS 5.11 Last change: 11 Jul 2001 1
ELF Library Functions elfversion(3ELF)
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Stable
MT-Level MT-Safe
SEE ALSO
elf(3ELF), elf32xlatetof(3ELF), elfbegin(3ELF),
libelf(3LIB), attributes(5)
NOTES
The working version should be the same for all operations on
a particular ELF descriptor. Changing the version between
operations on a descriptor will probably not give the
expected results.
SunOS 5.11 Last change: 11 Jul 2001 2
|