Top-Level Functions

void iio_strerror(int err, char *dst, size_t len)

Get a string description of an error code.

Parameters:
  • err – The error code. Can be positive or negative.

  • dst – A pointer to the memory area where the NULL-terminated string corresponding to the error message will be stored

  • len – The available length of the memory area, in bytes

bool iio_has_backend(const struct iio_context_params *params, const char *backend)

Check if the specified backend is available.

Parameters:
  • params – A pointer to a iio_context_params structure that contains context creation information; can be NULL

  • backend – The name of the backend to query

Returns:

True if the backend is available, false otherwise

unsigned int iio_get_builtin_backends_count(void)

Get the number of available built-in backends.

Returns:

The number of available built-in backends

const char *iio_get_builtin_backend(unsigned int index)

Retrieve the name of a given built-in backend.

Parameters:

index – The index corresponding to the backend

Returns:

On success, a pointer to a static NULL-terminated string

Returns:

If the index is invalid, NULL is returned

static inline void *iio_ptr(int err)

Encode an error code into a pointer.

Parameters:

err – The error code to be encoded. Must be negative.

Returns:

The error-encoding pointer.

static inline int iio_err(const void *ptr)

Returns the encoded error code if present, otherwise zero.

Parameters:

ptr – Pointer that is either valid or error-encoding

Returns:

The error code if present, otherwise zero.

static inline void *iio_err_cast(const void *ptr)

Type-cast an error-encoding pointer.

Parameters:

ptr – Error-encoding pointer

Returns:

An error-encoding pointer that can be used as a different type.