---
name: "gelf_getshdr"
section: "3"
platform: "linux"
package: "libelf"
version: "0.197-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/gelf_getshdr"
---

# gelf\_getshdr(3)

retrieve a section header into a class-independent structure

## NAME

gelf\_getshdr - retrieve a section header into a class-independent structure

## SYNOPSIS

```
#include <gelf.h>
GElf_Shdr *gelf_getshdr(Elf_Scn *scn, GElf_Shdr *dst);
```

## DESCRIPTION

**gelf\_getshdr**() retrieves the section header associated with the section descriptor *scn*, translating it into the class-independent **GElf\_Shdr** representation. The header is copied into the structure referenced by *dst*.

## PARAMETERS

- *scn*

  Pointer to a section descriptor of type **Elf\_Scn**.

- *dst*

  Pointer to a caller-provided **GElf\_Shdr** structure to receive the section header.

## RETURN VALUE

On success, **gelf\_getshdr()** stores the section header in *dst* and returns *dst*. On failure, NULL is returned and elf\_errno is set.  If *scn* is NULL then NULL is returned without setting elf\_errno.

## SEE ALSO

[**elf32\_getshdr**(3)](/elf32_getshdr/3.md), [**elf64\_getshdr**(3)](/elf64_getshdr/3.md), [**gelf\_update\_shdr**(3)](/gelf_update_shdr/3.md), [**libelf**(3)](/libelf/3.md), [**elf**(5)](/elf/5.md)

## ATTRIBUTES

| | | |
| --- | --- | --- |
| **Interface** | **Attribute** | **Value** |
| **gelf\_getshdr**() | Thread safety | MT-Safe |

## REPORTING BUGS

Report bugs to \<elfutils-devel@sourceware.org\> or https://sourceware.org/bugzilla/.
