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

# [NAME](#NAME)

elf\_errmsg - return the error message string for a given libelf error code.

# [SYNOPSIS](#SYNOPSIS)

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

**const char \*elf\_errmsg(int err);**

# [DESCRIPTION](#DESCRIPTION)

The **elf\_errmsg** function retrieves a human-readable string corresponding to the most recent error code set by a libelf library function. If *err* is 0, the function returns the error message for the most recent error code. If *err* is non-zero, the function returns the error message for the specified error code.

# [PARAMETERS](#PARAMETERS)

[*err*](#err)

An *int* value specifying the error code. If this value is 0, the function returns the error message for the most recent error or NULL if none occurred. If this value is -1, the behaviour is similar to the previous case except that a legal string will be returned instead of NULL.

# [RETURN VALUE](#RETURN_VALUE)

The **elf\_errmsg** function returns a string containing the error message. If there is no corresponding error message, it returns NULL.

# [SEE ALSO](#SEE_ALSO)

[**elf\_errno**(3)](/man/os/elfutils/elf_errno.3)

# [REPORTING BUGS](#REPORTING_BUGS)

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

2024-06-24 Libelf

---

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