Open System Services Porting Guide (G06.24+, H06.03+)
Table Of Contents
- What’s New in This Manual
- About This Manual
- 1 Introduction to Porting
- 2 The Development Environment
- 3 Useful Porting Tools
- 4 Interoperating Between User Environments
- Purpose of Interoperability
- The OSS User Environment
- OSS Commands for the Guardian User
- Guardian Commands for the UNIX User
- OSS Pathname and Guardian Filename Conversions
- Running the OSS Shell and Commands From TACL
- Running Guardian Commands From the OSS Shell
- Running OSS Processes With Guardian Attributes
- Using OSS Commands to Manage Guardian Objects
- 5 Interoperating Between Programming Environments
- 6 OSS Porting Considerations
- 7 Porting UNIX Applications to the OSS Environment
- 8 Migrating Guardian Applications to the OSS Environment
- General Migration Guidelines
- C Compiler Issues for Guardian Programs
- Using New and Extended Guardian Procedures
- Using OSS Functions in a Guardian Program
- Interoperating With OSS Programs
- Starting an OSS Program From the Guardian Environment
- C Compiler Considerations for OSS Programs
- Porting a Guardian Program to the OSS Environment
- How Arguments Are Passed to the C or C++ Program
- Differences in the Two Run-Time Environments
- Which Run-Time Routines Are Available
- Use of Common Run-Time Environment (CRE) Functions
- Replacing Guardian Procedure Calls With Equivalent OSS Functions
- Which IPC Mechanisms Can Be Used
- Interactions Between Guardian and OSS Functions
- 9 Porting From Specific UNIX Systems
- 10 Native Migration Overview
- 11 Porting or Migrating Sockets Applications
- 12 Porting Threaded Applications
- A Equivalent OSS and UNIX Commands for Guardian Users
- B Equivalent Guardian Commands for OSS and UNIX Users
- C Equivalent Inspect Debugging Commands for dbx Commands
- D Equivalent Native Inspect Debugging Commands for dbx Commands
- E Standard POSIX Threads Functions: Differences Between the Previous and Current Standards
- Glossary
- Index
Native Migration Overview
Open System Services Porting Guide—520573-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.