---
name: "rtld_get_var"
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/rtld_get_var"
---

# rtld\_get\_var(3)

query or change run-time linker parameters after image activation

## NAME

**rtld\_get\_var**, **rtld\_set\_var** – query or change run-time linker parameters after image activation

## LIBRARY

Standard C Library (libc, -lc)

## SYNOPSIS

**#include \<sys/errno.h\>**

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

*const* *char* *\**\

**rtld\_get\_var**(*const char \*name*);

*int*\

**rtld\_set\_var**(*const char \*name*, *const char \*value*);

## DESCRIPTION

The dynamic linker [rtld(1)](/rtld/1.md) can be configured by setting some environment variables for the process, before image activation. Sometimes it is desirable to query the current effective settings or change them afterward.

Since the process environment variables are maintained by higher-level libraries, the run-time linker cannot access them after the image activation. The described functions make it possible to operate on rtld settings.

The **rtld\_get\_var**() function returns the current value of the named parameter.

The **rtld\_set\_var**() functions changes the value of the parameter to the new *value* value, if possible. The *name* argument to both functions is the name of the parameter, which is same as the corresponding environment variable (see [rtld(1)](/rtld/1.md)) but without the LD\_ (or LD\_32\_ or any other ABI-specific) prefix.

The list of variables that can be modified with the **rtld\_set\_var**() function is:

- LD\_BIND\_NOT

  - LD\_BIND\_NOW

  - LD\_DEBUG

  - LD\_DUMP\_REL\_PRE

  - LD\_DUMP\_REL\_POST

  - LD\_DYNAMIC\_WEAK

  - LD\_LIBMAP\_DISABLE

  - LD\_LIBRARY\_PATH

  - LD\_LIBRARY\_PATH\_FDS

  - LD\_LIBRARY\_PATH\_RPATH

  - LD\_LOADFLTR

  ## RETURN VALUES

The **rtld\_get\_var**() returns the current value of the named parameter, or NULL if the name is invalid.

The **rtld\_set\_var**() returns 0 on success, or an integer indicating the error condition which prevented the operation.

## ERRORS

Possible errors returned from **rtld\_set\_var**():

- \[EPERM\]

  The requested change cannot be made at runtime, either because the runtime linker can only take this parameter at initialization time, or because the current process is executing with elevated privileges.

- \[ENOENT\]

  The supplied parameter *name* is unknown.

## SEE ALSO

[rtld(1)](/rtld/1.md)

## HISTORY

The **rtld\_get\_var** function first appeared in FreeBSD 14.3.
