Scalable Database Server, HiRDB Version 8 UAP Development Guide

[Contents][Index][Back][Next]

8.3.4 Compiling and linking when the multi-connection facility is used

Organization of this subsection
(1) For multi-thread UAPs
(2) For single-thread UAPs

(1) For multi-thread UAPs

This subsection explains how to compile and link normal, non-OLTP UAPs that use the multi-connection facility.

(a) In the UNIX environment

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)

For 32-bit mode:
libzcltk.sl

For 64-bit mode:
libzcltk64.sl

For 32-bit mode:
libcltk.a

For 64-bit mode:
libcltk64.a
DCE thread libzcltm.sl libcltm.a
HP-UX 11i V2 (IPF) Kernel thread
(native thread)

For 32-bit mode:
libzcltk.so

For 64-bit mode:
libzcltk64.so
[Figure]
Solaris Solaris thread
(native thread)

For 32-bit mode:
libzcltm.so
libzcltk.so

For 64-bit mode:
libzcltk64.so

For 32-bit mode:
libcltm.a
libcltk.a

For 64-bit mode:
libcltk64.a
AIX 5L POSIX thread

For 32-bit mode:
libzcltk.a

For 64-bit mode:
libzcltk64.a

For 32-bit mode:
libcltk.a

For 64-bit mode:
libcltk64.a
Linux POSIX thread libzcltk.so libcltk.a
Linux (IPF) POSIX thread libzcltk64.so [Figure]
Linux (EM64T) POSIX thread

For 32-bit mode:
libzcltk.so

For 64-bit mode:
libzcltk64.so
[Figure]

Legend:
[Figure]: Not applicable

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.

Example 1: Linking a UAP and a shared library in HP-UX 11.0
  • The post-source file name is sample and an executable form file name is not specified.
    cc -I/HiRDB/include sample.c -D_REENTRANT -D_HP_UX_SOURCE -D_POSIX_C_SOURCE=199506L
    -L/HiRDB/client/lib/ -lzcltk -lpthread

Example 2: Linking a UAP and a 64-bit mode shared library in HP-UX 11.0
  • The post-source file name is sample and an executable form file name is not specified.
    cc -I/HiRDB/include sample.c +DD64 -D_REENTRANT -D_HP_UX_SOURCE -D_POSIX_C_SOURCE=199506L
    -L/HiRDB/client/lib/ -lzcltk64 -lpthread

Example 3: Linking a Solaris-thread UAP and a shared library in Solaris
  • The post-source file name is sample and an executable form file name is not specified.
    cc -I/HiRDB/include sample.c -D_REENTRANT -L/HiRDB/client/lib/ -lzcltk -lthread
    -lnsl -lsocket

Example 4: Linking a POSIX-thread UAP and a shared library in Solaris
  • The post-source file name is sample and an executable form file name is not specified.
    cc -I/HiRDB/include sample.c -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS
    -L/HiRDB/client/lib/ -lzcltk -lthread -lnsl -lsocket

Example 5: Linking a Solaris-thread UAP and a 64-bit mode shared library in Solaris
  • The post-source file name is sample and an executable form file name is not specified.
    cc -I/HiRDB/include sample.c -xarch=v9 -D_REENTRANT -L/HiRDB/client/lib/
    -lzcltk64 -lthread -lnsl -lsocket

Example 6: Linking a POSIX-thread UAP and a 64-bit mode shared library in Solaris
  • The post-source file name is sample and an executable form file name is not specified.
    cc -I/HiRDB/include sample.c -xarch=v9 -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS
    -L/HiRDB/client/lib/ -lzcltk64 -lthread -lnsl -lsocket

Example 7: Linking a UAP and a shared library in Linux
  • The post-source file name is sample and an executable form file name is not specified.
    cc -I/HiRDB/include sample.c -D_REENTRANT -L/HiRDB/client/lib/ -lzcltk -lthread

Example 8: Linking a UAP and a shared library in AIX 5L
  • The post-source file name is sample and an executable form file name is not specified.
    xlc_r -I/HiRDB/include sample.c -L/HiRDB/client/lib/ -lzcltk

Example 9: Linking a UAP and a 64-bit mode shared library in AIX 5L
  • The post-source file name is sample and an executable form file name is not specified.
    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.

Example 1: Using DCE threads in HP-UX 11.0
  • The post-source file name is sample and an executable form file name is not specified.
     
    setenv CBLLIB /HiRDB/include
    ccbl -Mt sample.cbl -L/HiRDB/client/lib/ -lzcltm -ldce
     

Example 2: Using kernel threads in HP-UX 11.0
  • The post-source file name is sample and an executable form file name is not specified.
     
    setenv CBLLIB /HiRDB/include
    ccbl -Mt -Mp sample.cbl -L/HiRDB/client/lib/ -lzcltk -lpthread
     

Example 3: Linking a Solaris-thread UAP and a shared library in Solaris
  • The post-source file name is sample and an executable form file name is not specified.
     
    setenv CBLLIB /HiRDB/include
    ccbl -Mt -Mp sample.cbl -L/HiRDB/client/lib/ -lzcltk -lpthread
     

Example 4: Linking a POSIX-thread UAP and a shared library in Linux
  • The post-source file name is sample and an executable form file name is not specified.
     
    setenv CBLLIB /HiRDB/include
    ccbl -Mt -Mp sample.cbl -L/HiRDB/client/lib/ -lcltk -lpthread
     

Example 5: Linking a POSIX-thread UAP with a shared library in AIX 5L
  • The post-source file name is sample and an executable form file name is not specified.
     
    setenv CBLLIB /HiRDB/include
    ccbl -Mt -Mp sample.cbl -L/HiRDB/client/lib/ -lzcltk -lpthread
     
(b) In the Windows environment

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

Note
The underlined sections specify the HiRDB installation library.

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.


(2) For single-thread UAPs

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.

(a) Compiling and linking in HP-UX 11.0

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.

Example 1: Shared library
  • The post-source file name is sample and an executable form file name is not specified.
    cc -I/HiRDB/include sample.c -L/HiRDB/client/lib/ -lzclts

Example 2: Archive library
  • The post-source file name is sample and an executable form file name is not specified.
    cc -I/HiRDB/include sample.c -L/HiRDB/client/lib/libclts.a