Open System Services Porting Guide (G06.29+, H06.06+, J06.03+)
In the OSS environment, all of the compilation, linking, and optimization steps required to build
the final executables are specified in a make file. The make file, used by the make utility, contains
a list of dependencies for each target to be built. When migrating Guardian programs written in
C or C++ to the OSS environment, you are encouraged to use the set of tools available in the OSS
environment to build, test, and debug your application.
The same Inspect, Native Inspect, and Visual Inspect debuggers available in the Guardian
environment are available in the OSS environment. Additional tools such as ar(1), nm(1),
strip(1), and strings(1) are also available in the OSS environment. Read the appropriate
reference pages for these tools online or in the Open System Services Shell and Utilities Reference
Manual.
Memory and Data Models
In the OSS environment, only the wide-data model is supported. Thus, all modules, Guardian and
OSS, must be compiled with the wide-data model enabled. If the original Guardian C or C++
source code used the small-memory or large-memory model, all 16-bit int data elements become
32-bit int data elements. Thus, if your application requires 16 bits for a data element, use short
rather than int. If it does not matter whether the data element is 16 bits or 32 bits, you can
continue to use int. The use of the proper data type is particularly important when calling a
Guardian procedure that requires parameters to be a particular size. For information about memory
and data models, see “Memory and Data Models in TNS and Native Environments” (page 140).
Beginning with the H06.24 and J06.13 RVUs, both the ILP32 and LP64 data models are supported
and 64-bit addressable memory is available. For information about these data models and 64-bit
addressable memory, see the 64-Bit Support in OSS and Guardian chapter in the Open System
Services Programmer's Guide.
Header Files
The header files used by the c89 or c99 utility in the OSS environment are located in the
/usr/include directory, as in other UNIX systems. The contents of the header files are identical
to the contents of the corresponding header files maintained in the Guardian file system in
$system.system. The contents of /usr/include/stdio.h are identical to the contents of
$system.system.stdioh, for example.
Any Guardian C or C++ source code that includes completely qualified header file names in
Guardian filename syntax must be modified to use the equivalent OSS pathname syntax.
Include File Search Order
When C or C++ source modules are compiled in the Guardian environment, the search order for
header files included in the source code is given by the SSV pragma list provided. When using
c89 or c99, #include files with names enclosed in double quotes (" ") are searched for first in
the current directory. The #include files with names surrounded by angle brackets (<>) or the
continued search of #include files enclosed in double quotes occurs in the directories named
with the -I flags specified in the compiler command line in the order from left to right. Finally
#include files are searched for in the /usr/include directory.
New Pragmas
Some of the compiler pragmas used in Guardian C or C++ programs have no effect in the OSS
environment. When C or C++ program modules are compiled by c89 or c99, the following
pragmas are ignored or generate an error:
Generates executable object fileRUNNABLE
Searches object file to resolve external references (used with RUNNABLE)SEARCH
156 Migrating Guardian Applications to the OSS Environment