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-16
Examples of Working in the OSS Environment
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 details on binding internationalized programs, refer to the
Software Internationalization Manual.
Examples of Working in the OSS Environment
The following 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