After you finish coding the UOC, you must create a shared library. Specify the created shared library and the functions to be called in the control statements for pdload or pdrorg.
This example creates a shared library named libuoc.sl from the three source files sample1.c, sample2.c, and sample3.c:
$ /usr/bin/cc -c -I $PDDIR/include +z sample1.c sample2.c sample3.c
sample1.c:
sample2.c:
sample3.c:
$ /bin/ld -b -o libuoc.sl sample1.o sample2.o sample3.o
To execute the UOC on a HiRDB in the 64-bit mode, you must compile it in the 64-bit mode. In this case, specify +DD64 as the compile option. For the HP-UX (IPF) version, specify .so as the extension for shared libraries.
To execute the UOC on a POSIX library version of HiRDB, multi-threads must be supported. Note that multi-threads cannot be used within the UOC.
If you are using the POSIX library version of HiRDB, also note the following:
This example creates a shared library named libuoc.so from the three source files sample1.c, sample2.c, and sample3.c:
$ /usr/ucb/cc -c -I$PDDIR/include sample1.c sample2.c sample3.c
sample1.c:
sample2.c:
sample3.c:
$ /usr/css/bin/ld -G -o libuoc.so sample1.o sample2.o sample3.o
To execute the UOC on a HiRDB in the 64-bit mode, you must compile it in the 64-bit mode. In this case, specify -xarch=v9 as the compile option.
This example creates a shared library named libuoc.so from the three source files sample1.c, sample2.c, and sample3.c:
$ /usr/bin/cc -c -I$PDDIR/include sample1.c sample2.c sample3.c
sample1.c:
sample2.c:
sample3.c:
$ /usr/bin/cc -shared -o libuoc.so sample1.o sample2.o sample3.o
This example creates a shared library named libuoc.so from the three source files sample1.c, sample2.c, and sample3.c:
$ /usr/vac/bin/xlc -c -I$PDDIR/include sample1.c sample2.c sample3.c
sample1.c:
sample2.c:
sample3.c:
$ /usr/vac/bin/xlc -G -o libuoc.so sample1.o sample2.o sample3.o
To execute the UOC on a HiRDB in the 64-bit mode, you must compile it in the 64-bit mode. In this case, specify -q64 as the compile option.
To execute the UOC on a POSIX library version of HiRDB, multi-threads must be supported. Note that multi-threads cannot be used within the UOC.
If you are using a POSIX library version of HiRDB, also note the following:
During compilation, use the xlc_r command.
For details about supporting multi-threads, see the applicable OS documentation.