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

16 Compiling and Linking TNS/R Native C and C++
Programs
The TNS/R native C and C++ compilers take as input a module (a translation unit) and generate
an object file or linkfile. A module is defined as a source file with all the headers and source files
it includes, except for any source lines skipped as the result of conditional preprocessor directives.
The nld utility links object files generated by the compilers and produces an executable object
file (a program file).
The ld utility is the TNS/R native linker that links PIC (Position-Independent Code) linkfiles to
produce PIC loadfiles.
The SQL compiler processes executable files and generates code for embedded SQL statements.
The native c89 and c99 utilities control the C and C++ compilation system in the Open System
Services (OSS) environment. Note that the c89 utility on TNS/E systems can generate TNS/R code
for linking by the ld utility (not the eld utility) when the -Wtarget=tns/r flag is used; discussions
of OSS c89 in this section therefore apply to TNS/E users when that flag is specified.
For information on how to compile and link programs in the OSS environment, see the c89(1)
reference page online or in the Open System Services Shell and Utilities Reference Manual. For
more detail on converting from TNS c89 to TNS/R native c89, see the TNS/R Native Application
Migration Guide.
For information about compiling and binding native C++ programs using the Windows PC
environment, see the online help for the Enterprise Tool Kit. In this manual, the Enterprise Tool Kit
is introduced in Chapter 18: Using the Native C/C++ Cross Compiler on the PC.
Selecting a Development Platform
A development platform consists of the hardware system and software environment available to
compile, link, and run a program.
You can develop OSS programs regardless of whether the OSS environment is available on the
system. However, you cannot run and test OSS programs on a system without the OSS environment.
It is easier to develop a program in the environment in which it runs, but you can develop a program
in one environment that runs in another environment, with a few restrictions. However, compile
time is lesser in the PC environment.
Table 41 describes the capabilities of each development platform.
Table 41 Development Platform Capabilities (TNS/R Native C and C++ Programs)
NSDEE on Windows PCETK on
Windows PC
System with
Guardian and
System with
Guardian
environment
Capability
OSS
environments
YesNoYesYesUse Guardian development tools
for Guardian programs?
YesNoYesYesUse Guardian development tools
for OSS programs?
YesNoYesNoUse OSS development tools for
Guardian programs?
YesNoYesNoUse OSS development tools for
OSS programs?
YesNoYesYesRun Guardian programs?
YesNoYesNoRun OSS programs?
286 Compiling and Linking TNS/R Native C and C++ Programs