---
name: "elf_strptr"
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_strptr"
---

# elf\_strptr(3)

retrieve a string pointer in a string table

## NAME

**elf\_strptr** – retrieve a string pointer in a string table

## LIBRARY

library “libelf”

## SYNOPSIS

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

*char \**\

**elf\_strptr**(*Elf \*elf*, *size\_t scndx*, *size\_t stroffset*);

## DESCRIPTION

Function **elf\_strptr**() allows an application to convert a string table offset to a string pointer, correctly translating the offset in the presence of multiple *Elf\_Data* descriptors covering the contents of the section.

Argument *elf* is a descriptor for an ELF object. Argument *scndx* is the section index for an ELF string table. Argument *stroffset* is the index of the desired string in the string table.

## RETURN VALUES

Function **elf\_strptr**() returns a valid pointer on success or NULL in case an error was encountered.

## ERRORS

- \[ELF\_E\_ARGUMENT\]

  Argument *elf* was NULL

- \[ELF\_E\_ARGUMENT\]

  Argument *elf* was not a descriptor for an ELF object.

- \[ELF\_E\_ARGUMENT\]

  Argument *scndx* was not the section index for a string table.

- \[ELF\_E\_ARGUMENT\]

  Argument *stroffset* exceeded the size of the string table.

- \[ELF\_E\_ARGUMENT\]

  Argument *stroffset* index an unallocated region of the string table.

- \[ELF\_E\_DATA\]

  Offset *stroffset* indexed a region that was not covered by any Elf\_Data descriptor.

- \[ELF\_E\_DATA\]

  An erroneous *Elf\_Data* descriptor was part of the section specified by argument *scndx*.

- \[ELF\_E\_HEADER\]

  ELF descriptor *elf* contained an invalid section header.

- \[ELF\_E\_RESOURCE\]

  An out of memory condition was detected.

- \[ELF\_E\_SECTION\]

  Section *scndx* contained a malformed section header.

- \[ELF\_E\_SECTION\]

  The ELF descriptor in argument *elf* did not adhere to the conventions used for extended numbering.

## SEE ALSO

[elf(3)](/elf/3.md), [elf32\_getshdr(3)](/elf32_getshdr/3.md), [elf64\_getshdr(3)](/elf64_getshdr/3.md), [elf\_getdata(3)](/elf_getdata/3.md), [elf\_rawdata(3)](/elf_rawdata/3.md), [gelf(3)](/gelf/3.md), [gelf\_getshdr(3)](/gelf_getshdr/3.md)
