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

Table Of Contents
Compiling, Binding, and Accelerating TNS C
Programs
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
14-17
Examples of Working in the OSS Environment
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 using the library mylib.a before using the standard
library libc.a. The -O flag causes invocation of the Accelerator on the program
file.
8. In this example, c89 produces a program made up of modules compiled for both
the Guardian and OSS environments:
c89 -Wsystype=guardian -o guard.o -c guard1.c guard2.c
The command compiles the source files guard1.c and guard2.c for the
Guardian environment and generates an object file guard.o. The -c flag
suppresses the binding phase. The command:
c89 oss1.c oss2.c guard.o
compiles the source files oss1.c and oss2.c for the OSS environment, binds the
resulting object files with the object file guard.o to generate the program file
a.out.