Compile options

Use the C compiler to compile a C UDR.

Include the following compiler options:
  • Specify the necessary paths for any header files that the file needs, such as an mi.h header file, which includes the declarations of the DataBlade® API data type structures and functions.

    These paths include the following subdirectories of the main HCL Informix® installation directory (which the INFORMIXDIR environment variable specifies):

    • The incl/public subdirectory contains public header files, such as mi.h.
    • The incl/esql subdirectory contains Informix ESQL/C header files, such as decimal.h.
  • Indicate that the DataBlade API module is a C UDR with the following compiler flag:
    MI_SERVBUILD
On UNIX™ or Linux™, the following sample command compiles the C UDR in the abs.c source file:
/compilers/bin/cc -I $INFORMIXDIR/incl 
   -I $INFORMIXDIR/incl/esql -c abs.c

cc -KPIC -DMI_SERVBUILD -I$INFORMIXDIR/incl/public \
-I$INFORMIXDIR/incl -L$INFORMIXDIR/esql/lib -c abs.c
At run time:
LB_LIBRARY_PATH=/opt/informix/lib:/opt/informix/lib/esql
The following command is a sample of how to compile a C UDR named abs.c for Windows™:
cl /DNT_MI_SAPI /DMI_SERVBUILD 
-Id:\msdev\include -Id:\informix\incl\public 
-Id:\informix\incl -c abs.c