'\" te .\" Copyright 1989 AT&T Copyright (c) 1989, 2014, Oracle and/or its affliiates. All rights reserved. .TH elf_version 3ELF "8 September 2014" "SunOS 5.11" "ELF Library Functions" .SH NAME elf_version \- coordinate ELF library and application versions .SH SYNOPSIS .LP .nf cc [ \fIflag\fR ... ] \fIfile\fR ... \fB-lelf\fR [ \fIlibrary\fR ... ] #include \fBuint_t\fR \fBelf_version\fR(\fBuint_t\fR \fIver\fR); .fi .SH DESCRIPTION .sp .LP As \fBelf\fR(3ELF) explains, the program, the library, and an object file have independent notions of the latest \fBELF\fR version. \fBelf_version()\fR lets a program query the \fBELF\fR library's \fIinternal version\fR. It further lets the program specify what memory types it uses by giving its own \fIworking version\fR, \fBver\fR, to the library. Every program that uses the \fBELF\fR library must coordinate versions as described below. .sp .LP The header <\fBlibelf.h\fR> supplies the version to the program with the macro \fBEV_CURRENT\fR. 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, \fBelf_version()\fR will not accept a working version unknown to the library. .sp .LP Passing \fIver\fR equal to \fBEV_NONE\fR causes \fBelf_version()\fR to return the library's internal version, without altering the working version. If \fBver\fR is a version known to the library, \fBelf_version()\fR returns the previous (or initial) working version number. Otherwise, the working version remains unchanged and \fBelf_version()\fR returns \fBEV_NONE\fR. .SH EXAMPLES .LP \fBExample 1 \fRA sample display of using the \fBelf_version()\fR function. .sp .LP The following excerpt from an application program protects itself from using an older library: .sp .in +2 .nf if (elf_version(EV_CURRENT) == EV_NONE) { /* library out of date */ /* recover from error */ } .fi .in -2 .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilityCommitted _ MT-LevelMT-Safe .TE .SH SEE ALSO .sp .LP \fBelf\fR(3ELF), \fBelf32_xlatetof\fR(3ELF), \fBelf_begin\fR(3ELF), \fBlibelf\fR(3LIB), \fBattributes\fR(5) .SH NOTES .sp .LP The working version should be the same for all operations on a particular \fBELF\fR descriptor. Changing the version between operations on a descriptor will probably not give the expected results.