---
name: "libalpm_handle"
section: "3"
platform: "linux"
package: "pacman"
version: "7.1.0.r9.g54d9411-3"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libalpm_handle"
---

# libalpm\_handle(3)

Handle - Functions to initialize and release libalpm

## NAME

libalpm\_handle - Handle

 \- Functions to initialize and release libalpm

## SYNOPSIS

### Typedefs

typedef struct \_alpm\_handle\_t **alpm\_handle\_t**\
 The libalpm context handle.

### Functions

**alpm\_handle\_t** \* **alpm\_initialize** (const char \*root, const char \*dbpath, **alpm\_errno\_t** \*err)\
 Initializes the library.  int **alpm\_release** (**alpm\_handle\_t** \*handle)\
 Release the library.

## Detailed Description

Functions to initialize and release libalpm

## Typedef Documentation

### typedef struct \_alpm\_handle\_t alpm\_handle\_t

The libalpm context handle. This struct represents an instance of libalpm.

## Function Documentation

### alpm\_handle\_t \* alpm\_initialize (const char \* root, const char \* dbpath, alpm\_errno\_t \* err)

Initializes the library. Creates handle, connects to database and creates lockfile. This must be called before any other functions are called.

**Parameters**

*root* the root path for all filesystem operations \
 *dbpath* the absolute path to the libalpm database \
 *err* an optional variable to hold any error return codes

**Returns**

a context handle on success, NULL on error, err will be set if provided

References **alpm\_initialize()**.

Referenced by **alpm\_initialize()**.

### int alpm\_release (alpm\_handle\_t \* handle)

Release the library. Disconnects from the database, removes handle and lockfile This should be the last alpm call you make. After this returns, handle should be considered invalid and cannot be reused in any way.

**Parameters**

*handle* the context handle

**Returns**

0 on success, -1 on error

References **alpm\_release()**.

Referenced by **alpm\_release()**.

## Author

Generated automatically by Doxygen for libalpm from the source code.
