Scalable Database Server, HiRDB Version 8 UAP Development Guide
This subsection explains how to compile and link normal, non-OLTP UAPs that use the multi-connection facility.
For HP-UX 11.0, Solaris, AIX 5L, and Linux, link the libcltk.a and libzcltk.sl libraries. Table 8-21 shows the libraries to be linked when the multi-connection facility is used. For information about the libraries that must be linked for using multiple threads, see the manual for each operating system.
Table 8-21 Libraries to be linked when the multi-connection facility is used
UAP operating system | Thread used by UAP | Library to be linked | |
---|---|---|---|
Shared library file | Archive file | ||
HP-UX 11.0 | Kernel thread (native thread) |
|
|
DCE thread | libzcltm.sl | libcltm.a | |
HP-UX 11i V2 (IPF) | Kernel thread (native thread) |
|
|
Solaris | Solaris thread (native thread) |
|
|
AIX 5L | POSIX thread |
|
|
Linux | POSIX thread | libzcltk.so | libcltk.a |
Linux (IPF) | POSIX thread | libzcltk64.so | |
Linux (EM64T) | POSIX thread |
|
Examples of compiling and linking when the multi-connection facility is used by a UAP written in C are shown as follows. In these examples, the underlined sections specify the HiRDB installation library.
cc -I/HiRDB/include sample.c -D_REENTRANT -D_HP_UX_SOURCE -D_POSIX_C_SOURCE=199506L -L/HiRDB/client/lib/ -lzcltk -lpthread |
cc -I/HiRDB/include sample.c +DD64 -D_REENTRANT -D_HP_UX_SOURCE -D_POSIX_C_SOURCE=199506L -L/HiRDB/client/lib/ -lzcltk64 -lpthread |
cc -I/HiRDB/include sample.c -D_REENTRANT -L/HiRDB/client/lib/ -lzcltk -lthread -lnsl -lsocket |
cc -I/HiRDB/include sample.c -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -L/HiRDB/client/lib/ -lzcltk -lthread -lnsl -lsocket |
cc -I/HiRDB/include sample.c -xarch=v9 -D_REENTRANT -L/HiRDB/client/lib/ -lzcltk64 -lthread -lnsl -lsocket |
cc -I/HiRDB/include sample.c -xarch=v9 -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -L/HiRDB/client/lib/ -lzcltk64 -lthread -lnsl -lsocket |
cc -I/HiRDB/include sample.c -D_REENTRANT -L/HiRDB/client/lib/ -lzcltk -lthread |
xlc_r -I/HiRDB/include sample.c -L/HiRDB/client/lib/ -lzcltk |
xlc_r -I/HiRDB/include sample.c -q64 -L/HiRDB/client/lib/ -lzcltk64 |
UAPs written in COBOL must be compiled and linked with a multi-thread version (03-01 or later) of the COBOL85 compiler.
During compilation, specify the -Mt option (for POSIX threads, you must also specify the -Mp option). If an object compiled with the -Mt option is linked with an object compiled without the -Mt option, the operation is not guaranteed. For details about compiling UAPs written in COBOL, see the COBOL85 User's Guide.
Examples of compiling and linking when the multi-connection facility is used by a UAP written in COBOL are shown as follows. In these examples, the underlined sections specify the HiRDB installation directory.
setenv CBLLIB /HiRDB/include ccbl -Mt sample.cbl -L/HiRDB/client/lib/ -lzcltm -ldce |
setenv CBLLIB /HiRDB/include ccbl -Mt -Mp sample.cbl -L/HiRDB/client/lib/ -lzcltk -lpthread |
setenv CBLLIB /HiRDB/include ccbl -Mt -Mp sample.cbl -L/HiRDB/client/lib/ -lzcltk -lpthread |
setenv CBLLIB /HiRDB/include ccbl -Mt -Mp sample.cbl -L/HiRDB/client/lib/ -lcltk -lpthread |
setenv CBLLIB /HiRDB/include ccbl -Mt -Mp sample.cbl -L/HiRDB/client/lib/ -lzcltk -lpthread |
Link PDCLTM32.LIB instead of CLTDLL.LIB. The multi-connection facility cannot be used for a UAP that uses an X/Open-base API in OLTP.
This explanation assumes that Microsoft Visual C++ Version 4.2 is used. Select Set from the Project menu, and set the individual items. Table 8-22 shows the items that can be set with Set. If multiple threads are to be used, see the Operating System manual for details about the files that must be linked.
Table 8-22 Items to be set with Set
Item | Category | Category setting | Setting value |
---|---|---|---|
Compiler | Code generation | Alignment of structure members | 8 bytes |
Run time library to be used | Multi-thread DLL | ||
Preprocessor | Include file path | \HIRDB\INCLUDE | |
Linker | Input | Library | \HIRDB\LIB\PDCLTM32.LIB |
UAPs written in COBOL must be compiled and linked with a multi-thread version of the COBOL85 compiler. The descriptions in this subsection assume that COBOL85 Version 5.0 is being used.
During compilation, specify the -Mt option in the Compiler Option dialog box. If an object compiled with the -Mt option is linked with an object compiled without the -Mt option, the operation is not guaranteed. For details about compiling UAPs written in COBOL, see the COBOL85 User's Guide.
Table 8-23 shows items to be specified with the Option menu.
Table 8-23 Items to be specified with the Option menu
Submenu | Dialog box | Setting item | Setting value |
---|---|---|---|
Compiler | COBOL85 Compiler Option | COBOL85 compiler option | Check the -Mt item. |
Environment variable setting | CBLLIB=C:\HIRDB\INCLUDE | ||
Linker | Linker Option Setting | Import/user-specified library | C:\HIRDB\LIB\PDCLTM32 |
Note: Specify the HiRDB installation directory in the underlined sections.
This subsection explains how to compile and link single-thread UAPs that use the multi-connection facility. HP-UX 11.0 is used as an example for explanatory purposes.
Link the libclts.a or libzclts.sl instead of libclt.a or libzclt.sl.
During compilation, the following compilation options and libraries for multiple threads cannot be specified:
Also, pthread headers cannot be included.
Examples of compiling and linking when the multi-connection facility is used by a single-thread UAP written in C are shown as follows. In these examples, the underlined sections specify the HiRDB installation library.
cc -I/HiRDB/include sample.c -L/HiRDB/client/lib/ -lzclts |
cc -I/HiRDB/include sample.c -L/HiRDB/client/lib/libclts.a |
All Rights Reserved. Copyright (C) 2007, Hitachi, Ltd.