'\" te .\" Copyright 1989 AT&T Copyright (c) 2001, Sun Microsystems, Inc. All Rights Reserved .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .TH ELF_VERSION 3ELF "Jul 11, 2001" .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 \fBunsigned\fR \fBelf_version\fR(\fBunsigned\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 \fBif (elf_version(EV_CURRENT) == EV_NONE) { /* library out of date */ /* recover from error */ }\fR .fi .in -2 .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Interface Stability Stable _ MT-Level MT-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.