---
name: "elf_kind"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/elf_kind"
---

# elf\_kind(3)

determine ELF file type

## NAME

**elf\_kind** – determine ELF file type

## LIBRARY

library “libelf”

## SYNOPSIS

**#include \<libelf.h\>**

*Elf\_Kind*\

**elf\_kind**(*Elf \*elf*);

## DESCRIPTION

The **elf\_kind**() function identifies the kind of file associated with its argument *elf*. The argument *elf* is allowed to be NULL.

## RETURN VALUES

The **elf\_kind**() function returns one of the following values:

- ELF\_K\_AR

  The file associated with argument *elf* is an archive.

- ELF\_K\_ELF

  The file associated with argument *elf* is an ELF file.

- ELF\_K\_NONE

  The argument *elf* was NULL, or the ELF library could not determine the type of the file associated with argument *elf*, or an error occurred when processing.

## SEE ALSO

[elf(3)](/elf/3.md), [elf\_begin(3)](/elf_begin/3.md), [elf\_getident(3)](/elf_getident/3.md), [gelf(3)](/gelf/3.md)
