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

Table Of Contents
Migrating Guardian Applications to the OSS
Environment
Open System Services Porting Guide520573-006
8-28
Porting a Guardian Program to the OSS
Environment
Porting a Guardian Program to the OSS
Environment
When you make the decision to port your Guardian C or C++ program from the
Guardian environment to the OSS environment, there are more than C compiler issues
to take into consideration. You must also consider the following topics:
How Arguments Are Passed to the C or C++ Program on page 8-28
Differences in the Two Run-Time Environments on page 8-28
Which Run-Time Routines Are Available on page 8-29
Use of Common Run-Time Environment (CRE) Functions on page 8-30
Replacing Guardian Procedure Calls With Equivalent OSS Functions on page 8-31
Which IPC Mechanisms Can Be Used on page 8-31
Interactions Between Guardian and OSS Functions on page 8-31.
How Arguments Are Passed to the C or C++ Program
A program, compiled as a Guardian program, can be executed using the RUN
command from the TACL command interpreter as follows:
RUN program-file [ / run-options / ] [ arg1 arg2 ... argn ]
program-file specifies the name of the program to run. run-options is a comma-
separated list of options to the RUN command, enclosed in slashes (/). The two most
frequently specified RUN options are IN and OUT. The option IN input-file
specifies the name of the standard input file (stdin) for the new process, and the
option OUT output-file specifies the name of the standard output file (stdout) for
the new process. The arguments in the list of arguments to be passed to the program
(arg1 arg2 ... argn) are separated by spaces.
If the program is compiled as an OSS program, it can be run from the OSS shell
prompt as follows:
program-file [ arg1 arg2 ... argn ] <input-file >output-file
You can also use the run command built into the OSS shell to run a process with
Guardian attributes.
Differences in the Two Run-Time Environments
Before executing the code in the program, the C run-time library initializes its run-time
environment. It also calls a CRE initialization function to establish the CRE 's internal
data structures, I/O model, and so forth, as well as shared facilities such as the user
data heap. The C language-specific initialization function sets up the data structures
and the file I/O model specific to the C language. For Guardian processes, the C run-
time library performs several additional initialization tasks during the process startup
phase, including:
Processing the startup message sent by the command interpreter
Processing any command interpreter PARAM or ASSIGN messages