elf_errmsg(3)

elf_errmsg3

Return the error message string for a given libelf error code.

Usage

#include <libelf.h>

const char *elf_errmsg(int err);

Overview

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

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

The elf_errmsg function returns a string containing the error message. If there is no corresponding error message, it returns NULL.

Releases

Unchanged in 2 releases since Debian 13 (Trixie).

  1. 13–Arch

Reporting bugs

Report bugs to <[email protected]> or https://sourceware.org/bugzilla/.

From libelf 0.197-1 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.