Open System Services Programmer's Guide

B API Interoperability in TNS Processes
This appendix contains Table 77 (page 482), which describes the interoperability between the
Guardian API and the Open System Services (OSS) API in TNS processes. This appendix applies
only to G-series systems: the J-series and H-series OSS environments do not support TNS processes.
Table 77 lists the functions and macros in the Guardian C Run-Time Library and the OSS API.
Functions in the Guardian sockets library and Guardian system procedures are not included.
The table indicates the following characteristics for each function or macro:
Modules it can be called from
Processes it can be called from
Parameters it requires
Objects it can operate on
Calling Functions and Macros
The two factors that determine when you can call a function or macro are:
The environment for which the module containing the call was compiled.
The environment of the process executing the module.
An OSS module is a module compiled to have OSS semantics and execute in the OSS environment.
Likewise, a Guardian module is a module compiled to have Guardian semantics and execute in
the Guardian environment. Normally, the environments of a module and the process containing
the module are the same.
You can mix modules of different environments in the same process. An OSS process can execute
both OSS and Guardian modules, and a Guardian process can execute both Guardian and OSS
modules. See Chapter 1: Overview of the OSS Programming Environment (page 26) for a discussion
of when to write mixed-module applications.
Environment of the Module
The environment of a module is determined by the value of the SYSTYPE compiler pragma, which
directs the compiler to generate code appropriate for the specified target execution environment.
In Table 77, most functions and macros have the same name in both APIs, have identical parameter
lists, and the module will compile without errors regardless the environment you specify. A few
functions and macros, such as the open() function, have different parameter lists in the two APIs.
If you attempt to call the Guardian C open() function in a module compiled for the OSS
environment, you will get a compilation error because the parameter list is incorrect.
Environment of the Process
The environment of a process is determined by the environment of the module defining the main()
function.
Many functions and macros in the Guardian and OSS APIs can be called from a Guardian or
OSS module, which in turn can be part of a Guardian or OSS process. Some functions and macros,
such as the signal() function, can be called only from a Guardian module in a Guardian process
or from an OSS module in an OSS process.
For example, if you attempt to call the signal() function in a module compiled for the Guardian
environment, and then link this module to a main() function compiled for the OSS environment
(an OSS process), you will get a run-time error. This is because the system resources and services
required by the Guardian function cannot be provided by the OSS process environment.
Calling Functions and Macros 477