AIX CLI routine compile and link options
The compile and link options in this topic are recommended by Db2® for building CLI
routines (stored procedures and user-defined functions) with the AIX®
IBM® C compiler. They are demonstrated in the
sqllib/samples/cli/bldrtn
build script.
Compile options:
xlc_r
- Use the multi-threaded version of the IBM C compiler, needed as the routines may run in the same process as other routines (THREADSAFE) or in the engine itself (NOT FENCED).
$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. Compile and link are separate steps.
Link options:
xlc_r
- Use the multi-threaded version of the compiler as a front end for the linker.
$EXTRA_CFLAG
- Contains the value "-q64" for 64-bit environments; otherwise, contains no value.
-qmkshrobj
- Create the shared library.
-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.
-bE:$.exp
- Specify an export file. The export file contains a list of routines.
Refer to your compiler documentation for additional compiler options.