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
Interoperating Between User Environments
Open System Services Porting Guide—520573-006
4-13
Compiling and Linking Programs From OSS
In the following example, the -o parameter limits the output to those spool jobs queued
to a specific printer location (in this case, $S.#LASER):
lpstat -o laser
These examples specify the spool destination using an alias; this is true for both lp
and lpstat utilities. The definitions of the spool location abbreviations are specified in
the /etc/printcap file. Your system administrator is responsible for setting up and
maintaining this file. If the /etc/printcap file contains the alias of laser for the
spool location $S.#LASER, then the output goes to the printer called #LASER,
controlled by the Guardian process named $S.
Compiling and Linking Programs From OSS
There are two native-mode C compilers: one runs in the OSS environment and one
runs in the Guardian environment. Each compiler compiles OSS and Guardian
programs and produces identical code. However, each compiler has different default
pragma settings.
Compiling and linking programs for the OSS environment is done using the c89 utility,
a compilation driver program. OSS uses a naming convention in which a name is
formatted into two parts, separated by a period. The first part is a name chosen by the
user; the second part is a one-letter suffix, identifying the file’s contents. For
C programming, the most common suffixes are:
Examples
The following command compiles the C source code file testprg.c. By default, c89
produces the executable a.out file:
c89 testprg.c
The Guardian equivalents to this example would be similar to the following commands,
which produces an executable file called OBJECT by default. (The code produced in
each environment is not identical, but equivalent in function.)
TNS/R native:
NMC /IN TESTPRGC, OUT LISTFILE/ AOUT; RUNNABLE
TNS/E native:
CCOMP /IN TESTPRGC, OUT LISTFILE/ AOUT; RUNNABLE
The TNS C compiler equivalent would be:
C /IN TESTPRGC, OUT LISTFILE/ AOUT; RUNNABLE, WIDE
Suffix Description
c C source file
h Header or include file
o Compiled but unbound code, usually referred to as an “object file”