18.2.200. PMIx_Device_create

PMIx_Device_create — Allocate and initialize an array of pmix_device_t(5) structures.

18.2.200.1. SYNOPSIS

#include <pmix.h>

pmix_device_t* PMIx_Device_create(size_t n);

18.2.200.1.1. Python Syntax

No Python equivalent

18.2.200.2. INPUT PARAMETERS

18.2.200.3. DESCRIPTION

Allocate a contiguous array of n pmix_device_t structures on the heap and construct each element, as though PMIx_Device_construct(3) had been called on every member (uuid and osname set to NULL, type set to PMIX_DEVTYPE_UNKNOWN).

The returned array is owned by the caller and must eventually be released with PMIx_Device_free(3), which destructs the contents of each element and frees the array storage.

18.2.200.4. RETURN VALUE

Returns a pointer to the newly allocated array of pmix_device_t structures, or NULL if n is zero or the allocation fails.

18.2.200.5. EXAMPLES

Create and later release an array of three device structures:

pmix_device_t *devs;

devs = PMIx_Device_create(3);
if (NULL == devs) {
    /* handle allocation failure */
}

/* ... populate and use the array ... */

PMIx_Device_free(devs, 3);