---
name: "elf_getarhdr"
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_getarhdr"
---

# elf\_getarhdr(3)

retrieve ar(1) header for an archive member

## NAME

**elf\_getarhdr** – retrieve [ar(1)](/ar/1.md) header for an archive member

## LIBRARY

library “libelf”

## SYNOPSIS

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

*Elf\_Arhdr \**\

**elf\_getarhdr**(*Elf \*elf*);

## DESCRIPTION

The **elf\_getarhdr**() function returns a pointer to an archive member header for a descriptor *elf*. This descriptor must have been returned by a prior call to [elf\_begin(3)](/elf_begin/3.md), and must be a descriptor for a member inside an [ar(1)](/ar/1.md) archive.

Structure *Elf\_Arhdr* includes the following members:

- *char \** *ar\_name*

  A pointer to a null terminated string containing the translated name of the archive member.

- *char \** *ar\_rawname*

  A pointer to a null terminated string containing the untranslated name for the archive member, including all [ar(1)](/ar/1.md) formatting characters and trailing white space.

- *time\_t* *ar\_date*

  The timestamp associated with the member.

- *uid\_t* *ar\_uid*

  The uid of the creator of the member.

- *gid\_t* *ar\_gid*

  The gid of the creator of the member.

- *mode\_t* *ar\_mode*

  The file mode of the member.

- *size\_t* *ar\_size*

  The size of the member in bytes.

## RETURN VALUES

This function returns a valid pointer to an *Elf\_Arhdr* structure if successful, or NULL if an error is encountered.

## ERRORS

Function **elf\_getarhdr**() may fail with the following errors:

- \[ELF\_E\_ARGUMENT\]

  Argument *elf* was NULL.

- \[ELF\_E\_ARGUMENT\]

  Argument *elf* was not a descriptor for a member of an [ar(1)](/ar/1.md) archive.

## SEE ALSO

[elf(3)](/elf/3.md), [elf\_begin(3)](/elf_begin/3.md), [elf\_getarsym(3)](/elf_getarsym/3.md), [elf\_memory(3)](/elf_memory/3.md)
