INFORMIX-Universal Server provides a Global Language Support
Application Programmer's Interface (GLS API) enabling you to develop
internationalized applications with a C-based interface. The GLS API relies
on GLS locales which determine how an internationalized application
behaves.
The GLS API provides the following ...
How to use the GLS API
You can use the GLS API either on the client or the server. All functions
access the current processing locale. The current processing locale, based
on the GLS environment variables and data stored in the database, must be
established on both the server and client before any locale sensitive
processing occurs. The server establishes the locale when a database is
opened (or when a session corresponding to a client connection is
established). A client-side application needs to explicitly set the
processing locale with a function call.
Compiling and linking the GLS API
To use the GLS API, you must include the following code in your GLS API
based programs:
#include <ifxgls.h>
ESQL/C users need to ensure that the correct processing locale is established
by calling ifx_gl_init() prior to calling
ifx_gl_*() functions. To compile and link ESQL/C programs that use the GLS
API, issue the following ESQL command:
% esql <source_file>
Client-side users of DataBlade module API also need to ensure that the
correct processing locale is established by calling
ifx_gl_init() prior to calling ifx_gl_*()
functions. To compile and link DataBlade module programs:
% cc -I$INFORMIXDIR/incl/esql -L$INFORMIXDIR/lib/esql ... -lixgls ...
<source_file>
Additionally, DataBlade module programmers need to distinguish whether
a DataBlade module runs on the server or on a client when they compile user-
defined routines. To make this distinction, use the compiler flag
-DMI_SERVBUILD when compiling user-defined routines.
Tip: When you use the Database Developer's Kit (DBDK) to compile user-
defined routines you do not have to explicitly specify the location of the
header files.
To build a shared object that contains the C code for a user-defined routine,
use the following example:
% cc -I$INFORMIXDIR/incl/esql -KPIC -DMI_SERVBUILD -c <source_file>
% ld -G -o <shared object name>.so <source_file>.o
The type that holds a single 4-byte wide-character.
gl_mchar_t
An integral type that holds a single byte which is part of a multibyte
character; given that a multi-byte character is composed of one or more
gl_mchar_t's, it makes no sense to define or refer to a variable as an
gl_mchar_t. Instead always use the type (gl_mchar_t *) when,(1) defining
or referring to a single multi- byte character, and (2) when defining or
referring to a string of multi-byte characters.