elf_version(3E) elf_version(3E)
NAME
elfversion - coordinate ELF versions
SYNOPSIS
cc [flag ...] file ... -lelf [library ...]
#include <libelf.h>
unsigned elfversion(unsigned ver);
DESCRIPTION
As elf(3E) explains, the program, the library, and an object file have
independent notions of the "latest" ELF version. elfversion() lets a
program determine the ELF library's internal version. It further lets
the program specify what memory types it uses by giving its own work-
ing version, ver, to the library. Every program that uses the ELF
library must coordinate versions as described below.
The header file libelf.h supplies the version to the program with the
macro EVCURRENT. If the library's internal version (the highest ver-
sion known to the library) is lower than that known by the program
itself, the library may lack semantic knowledge assumed by the pro-
gram. 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 pre-
vious (or initial) working version number. Otherwise, the working ver-
sion remains unchanged and elfversion() returns EVNONE.
EXAMPLE
The following excerpt from an application program protects itself from
using an older library.
if (elfversion(EVCURRENT) == EVNONE)
{
/* library out of date */
/* recover from error */
}
NOTES
The working version should be the same for all operations on a partic-
ular elf descriptor. Changing the version between operations on a
descriptor will probably not give the expected results.
SEE ALSO
elf(3E), elfbegin(3E), elfxlate(3E).
Page 1 Reliant UNIX 5.44 Printed 11/98