AIX CLI application compile and link options

The compile and link options in this topic are recommended by Db2 for building CLI applications with the AIX® IBM® C compiler. They are demonstrated in the sqllib/samples/cli/bldapp build script.

Compile options:

xlc
The IBM C compiler.
$EXTRA_CFLAG
Contains the value "-q64" for 64-bit environments; otherwise, contains no value.
-I$DB2PATH/include
Specify the location of the Db2 include files. For example: $HOME/sqllib/include
-c
Perform compile only; no link. This script has separate compile and link steps.

Link options:

xlc
Use the compiler as a front end for the linker.
$EXTRA_CFLAG
Contains the value "-q64" for 64-bit environments; otherwise, contains no value.
-o $1
Specify the executable program.
$1.o
Specify the object file.
utilcli.o
Include the utility object file for error checking.
-L$DB2PATH/$LIB
Specify the location of the Db2 runtime shared libraries. For example: $HOME/sqllib/$LIB. If you do not specify the -L option, the compiler assumes the following path: /usr/lib:/lib.
-ldb2
Link with the Db2 library.

Refer to your compiler documentation for additional compiler options.