Open System Services Porting Guide (G06.24+, H06.03+)

Table Of Contents
Native Migration Overview
Open System Services Porting Guide520573-006
10-6
C Language Compilers
Two types of user libraries are supported: TNS user libraries and native user libraries.
A TNS user library is available only to TNS interpreted and accelerated processes in
the Guardian environment. A native user library is available only to native processes in
the Guardian and OSS environments. The memory architecture and implementation of
native user libraries differs from TNS user libraries, but these differences do not affect
the restrictions on and capabilities of user libraries.
A native user library can be either a position-independent code (PIC) file or a non-PIC
file. A non-PIC native user library is built using the nld linker with a -ul flag; a PIC
user library is built using the ld linker (in a TNS/R environment) or the eld linker (in a
TNS/E environment) with a -ul flag. The -ul flag causes ld, nld, or eld to link the file
for use as a native user library. The user library for native programs can be specified
using the ld, nld, or eld utility or the c89 utility. For a conventional user library:
nld -libname library ...
c89 -Wnld="-libname library" ...
For a TNS/R PIC user library:
ld -libname library ...
c89 -Wld="-libname library" ...
For a TNS/E user library:
eld -libname library ...
c89 -Wld="-libname library" ...
The precedence rules for TNS and native programs are the same: user libraries
specified in the command line override those specified in Binder, ld, nld, and eld
commands.
C Language Compilers
The native C compilers accept the Common C language as input as well as strict
ISO/ANSI C code. There are differences in the ISO/ANSI C implementation-defined
behaviors of some functions and in compiler limits for native C and C++.
Programs written for the TNS environment probably need modification if the programs
are to run in native mode. Guidelines should include the following steps. Refer to the
TNS/R Native Application Migration Guide for details on migrating to the TNS/R native
environment. Refer to the H-Series Application Migration Guide for additional changes
that might be required to migrate from the TNS/R native environment to the TNS/E
native environment.
1. Make sure your C or C++ source code is written for the large memory model and
the 32-bit data model because these are the only options supported for Open
System Services. The best way to ensure this is to use the proper prototype
function declarations with the proper argument type declarations. For the standard
library routines, the declarations are in the appropriate system header files.
2. The placement of pragmas is more restrictive with the native C compilers. Some
source-level pragmas might require being moved to the command line as flags.