ELF\_VERSION(3) Libelf Programmer's Manual ELF\_VERSION(3)

# [NAME](#NAME)

elf\_version - set the ELF version for libelf.

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;libelf.h&gt;**

**unsigned int elf\_version(unsigned int version);**

# [DESCRIPTION](#DESCRIPTION)

The **elf\_version** function sets libelf's ELF version to the specified value. This function must be called before any other libelf functions are used.

# [PARAMETERS](#PARAMETERS)

[*version*](#version)

An *unsigned int* value specifying the desired ELF version for the library. This is should be set to **EV\_CURRENT** to indicate the current ELF version. At this time the only supported ELF version is **EV\_CURRENT**.

# [RETURN VALUE](#RETURN_VALUE)

The **elf\_version** function returns **EV\_CURRENT** if *version* is supported and sets the library's ELF version to this value. If the given *version* is **EV\_NONE**, then this function returns **EV\_CURRENT** and does not set the library's ELF version. If the specified version is not supported, this function returns **EV\_NONE**.

# [REPORTING BUGS](#REPORTING_BUGS)

Report bugs to &lt;elfutils-devel@sourceware.org&gt; or https://sourceware.org/bugzilla/.

2024-06-26 Libelf

---

Document: elf_version(3) from elfutils 0.196-r0 (Chainguard OS)
Source: https://sourceware.org/git/elfutils.git
