C/C++ Programmer's Guide (G06.25+)

Compiling, Binding, and Accelerating TNS C
Programs
HP C/C++ Programmer’s Guide for NonStop Systems429301-008
14-9
Binding a C Module
The COSS and CWIDE library files support the 32-bit data model. Bind OSS modules
with COSS and bind Guardian modules with CWIDE. If you compile all modules in a
program using the header files supplied by HP, you can bind using either COSS or
CWIDE. If you do not use header files, you must bind using the library file that supports
the module’s environment.
You can only use static binding for Guardian programs. You can use static binding or
dynamic binding for OSS programs. In static binding, the Binder resolves references to
library functions by binding the functions into the program. In dynamic binding, the
Binder resolves references to library functions using a TNS shared run-time library
(SRL). Final resolution of references is performed at run time.
A TNS shared run-time library (SRL) is a special form of a TNS user library that can
contain global variables. Programs that use an SRL cannot use a user library. HP
provides TNS SRLs for OSS and NonStop TUXEDO. You cannot build your own TNS
SRLs. Do not confuse TNS SRLs with the TNS/R native SRLs provided on D40 and
later software releases. For information on native SRLs, see Shared Run-Time
Libraries (SRLs) on page 16-13.
To specify an SRL for an OSS TNS module compiled in the Guardian environment, do
one of the following:
Move the compiled object code file to the G-series OSS environment and use the
OSS environment TNS c89 utility to specify the SRL and dynamically bind the
program. For example, to specify an SRL for the object file myobject, enter:
c89 -Wbind myobject
Specify a Binder SET IMPORT command when building the program. For details,
refer to the Binder Manual.
For more information, refer to the TNS c89 online reference page (man -M
/nonnative/usr/share/man c89). The c89 reference page in D40 and later
versions of the Open System Services Shell and Utilities Reference Manual describes
the native c89 utility.
Changes in Binding CLIB
On C-series systems, the C run-time library resided in a file, CLIB, that had to be
bound into each object file that contains C functions. On systems runing D-series
RVUs, the TNS C run-time library was split between two files, CLIB and CRELIB.
Because CLIB and CRELIB were configured into the system library, you do not bind
them into object files.
The D20 and later C run-time libraries have significant architectural differences.
Because of these differences, D20 programs that bound in CLIB without also binding in
CRELIB do not run correctly on D30 or later releases. You must bind such programs
again without CLIB or CRELIB. CLIB is no longer released as a separate file. Check