The mi_new_var() function

The mi_new_var() function creates a new varying-length structure for text data.

Syntax

mi_lvarchar *mi_new_var(data_len)
   mi_integer data_len;
data_len
The length of the data to store in the new varying-length structure.
Valid in client LIBMI application? Valid in user-defined routine?
Yes Yes

Usage

The mi_new_var() function is a constructor function for a varying-length structure. It allocates a varying-length structure with data_len bytes of data in its data portion. The function allocates memory for the varying-length structure that it returns. Therefore, you must use the mi_var_free() function to free this structure when it is no longer needed.

Server only: The mi_new_var() function allocates a new varying-length structure with the current memory duration.
Restriction: Do not use the DataBlade® API memory-management functions such as the mi_alloc() function to allocate a varying-length structure.

Return values

An mi_lvarchar pointer
A pointer to the new variable-length structure.
NULL
The function was not successful.