The gl_mchar_t data type
The HCL Informix® GLS library represents a multibyte character with the gl_mchar_t data type. The gls.h header file defines the gl_mchar_t data type, and the ifxgls.h header file includes gls.h. Therefore, you must include ifxgls.h in any file that uses the gl_mchar_t data type (or any Informix GLS function).
Restriction: The gl_mchar_t data type is an opaque
structure. Do not access the individual bytes of a multibyte character
directly.
Because any character in a multibyte-character string might contain
up to 4 bytes, and gl_mchar_t refers to only one of those bytes,
you usually declare a multibyte variable as a pointer to a gl_mchar_t data
type. For example, the following declaration creates the mb_string variable
as a pointer to a multibyte-character string:
#include <ifxgls.h>;
...
gl_mchar_t *mb_string;
The preceding declaration assumes that the application allocates memory for the mb_string multibyte string elsewhere.
You can also cast a C string to a multibyte-character string, as
follows:
char *string; /* allocated & initialized elsewhere */
...
gl_mchar_t *mbs = (gl_mchar_t *) string;