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

# elf\_getscn(3)

retrieve a descriptor for an ELF section at a specified index.

## NAME

elf\_getscn - retrieve a descriptor for an ELF section at a specified index.

## SYNOPSIS

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

**Elf\_Scn \*elf\_getscn(Elf \****elf***, size\_t** *index***);**

## DESCRIPTION

The **elf\_getscn** function retrieves a section descriptor for the section at the specified index in the ELF object referred to by *elf.*

## PARAMETERS

- *elf*

  An *Elf* pointer to the ELF object from which the section descriptor is to be retrieved.

- *index*

  A *size\_t* value representing the index of the section whose descriptor is to be retrieved. Section indices start at 0.  The section at index 0 is always **SHT\_NULL** and does not contain any data.

## RETURN VALUE

The **elf\_getscn** function returns a pointer to the *Elf\_Scn* for the section at the specified index. If an error occurs, it returns NULL and sets an appropriate libelf error code.

## ATTRIBUTES

For an explanation of the terms used in this section, see [**attributes**(7)](/attributes/7.md).

| | | |
| --- | --- | --- |
| **Interface** | **Attribute** | **Value** |
| **elf\_getscn**() | Thread safety | MT-Safe |

## SEE ALSO

[**elf\_errno**(3)](/elf_errno/3.md), [**libelf**(3)](/libelf/3.md), [**elf**(5)](/elf/5.md)

## REPORTING BUGS

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