C/C++ Programmer's Guide (G06.27+, H06.08+, J06.03+)

You can also perform static binding for OSS programs. In static binding, the Binder resolves
references to library functions by binding the functions into the program. Static libraries can be
used for dynamic binding. The Binder resolves external references using all the specified static
libraries before using the SRL.
Binding Considerations
To bind a Guardian program with the TNS c89 utility, specify the libgwc.a library.
libgwc.a is equivalent to the Guardian file CWIDE. The -Wsystype=guardian flag sets
the default library to libgwc.a.
You cannot use an SRL for Guardian programs. Only OSS programs can use an SRL.
You must bind internationalized programs using an SRL that supports internationalization. For
more details on binding internationalized programs, see the Software Internationalization
Manual.
Examples of Working in the OSS Environment
These examples show you how to use the TNS c89 utility to compile, bind, and accelerate programs
in the OSS environment.
1. In this example, c89 compiles source file test1.c and binds the object file into program file
a.out. The default shared run-time library libc.so is used to resolve external references
with dynamic binding:
c89 test1.c
2. In this example, c89 compiles source file test2.c into object file test2.o:
c89 -c test2.c
3. In this example, c89 compiles source file test3.c, binds the resultant object file, and
accelerates the program file into an accelerated program file a.out. Binder uses the default
shared run-time library libc.so to resolve external references, and the compiler generates
a symbols region for symbolic debugging:
c89 -g -O test3.c
4. In this example, c89 invokes the SQL compiler for the object file test4.o:
c89 -Wsql test4.o
5. In this example, c89 compiles source file test5.c and binds the object file into program file
testprog. Binder uses the library libmine.a to resolve external references before the
library libc.a. Because libmine.a and libc.a are not shared run-time libraries, static
binding is performed:
c89 -o testprog -l mine -l c test5.c
6. In this example, c89 compiles the source file gprogram.c and binds the object file into
program file a.out. Binder uses the default library for the Guardian environment, libgwc.a,
to resolve external references. Static binding is performed:
c89 -Wsystype=Guardian gprogram.c
7. In this example, c89 produces a statically bound program:
c89 -o test3 -O -D TYPE=3 -I /usr/myself/header
-I /usr/friend -WBstatic x1.c x2.o x3.c -l mylib
The command compiles source files x1.c and x3.c and binds the object files together with
x2.o into program file test3. During compilation, the preprocessor symbol TYPE is defined
and is assigned the value 3. The compiler looks for header files in directory
/usr/myself/header first, then it looks in /usr/friend, and finally it looks in
/usr/include. Static binding has been specified, so the Binder tries to resolve references
Working in the OSS Environment 271