The compile and link
options for building C embedded SQL and DB2® API
applications with the Forte C compiler are available in the bldapp build
script.
Compile and link options for bldapp
Compile
options:
- cc
- The C compiler.
- -xarch=$CFLAG_ARCH
- This option ensures that the compiler will produce valid executables
when linking with libdb2.so. The value for $CFLAG_ARCH
is set as follows:
- "v8plusa" for 32-bit applications on Solaris SPARC
- "v9" for 64-bit applications on Solaris SPARC
- "sse2" for 32-bit applications on Solaris x64
- "amd64" for 64-bit applications on Solaris x64
- -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:
- cc
- Use the compiler as a front end for the linker.
- -xarch=$CFLAG_ARCH
- This option ensures that the compiler will produce valid executables
when linking with libdb2.so. The value for $CFLAG_ARCH
is set to either "v8plusa" for 32-bit, or "v9" for 64-bit.
- -mt
- Link in multi-thread support. Needed for linking with libdb2.
Note: If POSIX threads are used, DB2 applications
also have to link with -lpthread, whether or not
they are threaded.
- -o $1
- Specify the executable.
- $1.o
- Include the program object file.
- utilemb.o
- If an embedded SQL program, include the embedded SQL utility object
file for error checking.
- utilapi.o
- If not an embedded SQL program, include the DB2 API utility object file for error checking.
- -L$DB2PATH/$LIB
- Specify the location of the DB2 static
and shared libraries at link-time. For example, for 32-bit: $HOME/sqllib/lib32,
and for 64-bit: $HOME/sqllib/lib64.
- $EXTRA_LFLAG
- Specify the location of the DB2 shared
libraries at run time. For 32-bit it contains the value "-R$DB2PATH/lib32",
and for 64-bit it contains the value "-R$DB2PATH/lib64".
- -ldb2
- Link with the DB2 library.
Refer to your compiler documentation for additional
compiler options.