gelf_getclass(3)

gelf_getclass3

Return the elf class (32-bit or 64-bit) for an object

Usage

#include <gelf.h>
int gelf_getclass(Elf *elf);

Overview

gelf_getclass() returns the class of the ELF object referenced by elf. The class of a valid ELF file will be one of:

ELFCLASS32

The object is a 32-bit ELF class.

ELFCLASS64

The object is a 64-bit ELF class.

If elf does not denote a valid ELF object, or the class cannot be determined, ELFCLASSNONE is returned.

Return value

Returns ELFCLASS32 or ELFCLASS64 on success. If elf is NULL or does not refer to a valid ELF binary with kind ELF_K_ELF, then ELFCLASSNONE is returned.

Attributes

InterfaceAttributeValue
gelf_getclass()Thread safetyMT-unsafe race

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.