---
name: "mdex_init"
section: "3"
platform: "linux"
package: "liblibrecast-dev"
version: "0.9.1-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mdex_init"
---

# mdex\_init(3)

initialize and free a multicast index

## NAME

mdex\_init, mtree\_free - initialize and free a multicast index

## LIBRARY

Librecast library (*liblibrecast*, *-llibrecast*)

## SYNOPSIS

```
#include <librecast/mdex.h>
```

**mdex\_t \*mdex\_init(size\_t** *entries***);** **void mdex\_free(mdex\_t** *\*mdex***);**

Compile and link with *-llibrecast*.

## DESCRIPTION

The **mdex\_init** function initializes a multicast index.

*entries* gives the initial number of entries to allocate. This is just a hint for initial memory allocation, and the index will be resized as required.

## RETURN VALUE

**mdex\_init**() returns a pointer to a *mdex\_t* handle, which should be freed by passing to **mdex\_free**() when done. On error, NULL is returned, and *errno* is set to indicate the error.

The **mdex\_free**() function returns no value, and preserves *errno*.

## ERRORS

- **ENOMEM**

  Not enough space/cannot allocate memory (POSIX.1-2001).

## SEE ALSO

[**mdex\_get**(3)](/mdex_get/3.md), [**mdex\_put**(3)](/mdex_put/3.md), [**mdex\_del**(3)](/mdex_del/3.md)
