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

# dwarf\_get\_address\_size(3)

return the number of bytes needed to represent an address

## NAME

**dwarf\_get\_address\_size** – return the number of bytes needed to represent an address

## LIBRARY

library “libdwarf”

## SYNOPSIS

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

*int*\

**dwarf\_get\_address\_size**(*Dwarf\_Debug dbg*, *Dwarf\_Half \*addr\_size*, *Dwarf\_Error \*err*);

## DESCRIPTION

Function **dwarf\_get\_address\_size**() returns the size in bytes of a native address for a program object.

Argument *dbg* should denote a DWARF debug context created from a program object using [dwarf\_init(3)](/dwarf_init/3.md). Argument *addr\_size* should point to a location that will hold the returned size. Argument *err*, if non-NULL, it will be used to return error information.

## RETURN VALUES

On success, function **dwarf\_tag**() returns DW\_DLV\_OK. In case of an error, it returns DW\_DLV\_ERROR and sets argument *err*.

## ERRORS

Function **dwarf\_get\_address\_size**() can fail with the following error:

- \[DW\_DLE\_ARGUMENT\]

  Either of arguments *dbg* or *addr\_size* was NULL.

## SEE ALSO

[dwarf(3)](/dwarf/3.md), [dwarf\_finish(3)](/dwarf_finish/3.md), [dwarf\_init(3)](/dwarf_init/3.md)
