Avoiding Pitfalls in Multi-Language Programming

Debugging Tips
POSIX Environment
This paper will not address the issues of interfacing with the older compatibility mode languages and
data types.
That it is possible at all to intermix routines from multiple languages is due to the HP Precision
Architecture Procedure Calling Convention as described in the
Procedure Calling Conventions
Manual, which is listed in the Bibliography.
To permit this paper to address the diverse
issues and multiple languages herein, it has been
necessary to generalize statements and to omit minor exceptions that might
contradict those
generalities. The references are the most complete description of the topics discussed and should be
used as the authoritative source for actual implementation. We
intend that this paper will be of use as
an overview of the subject.
Data Representation
Pitfalls:
Pascal data types not generally supported by
other languages include enumerated types, sets, and
pointers.
Fortran REAL*16 datatype is not supported by other languages.
Cobol does not support floating-point data types.
Basic DECIMAL format is different from Cobol PACKED-DECIMAL.
RPG only passes character and packed decimal parameters.
TRANSACT supports several extended precision datatype sizes not available elsewhere.
Strings are stored in differing formats by
the various languages. Only the simplest character arrays
are transferable among most languages.
Recommendations:
Use the simple data types (integers, characters, and reals).
Details:
Table 1
Data Representation Equivalences Across Languages
Data Types that are highly compatible across many languages:
Pascal Fortran Cobol C Basic Transact Note ---------------------------------------------
----------------------------------------------------------------------
Char CHARACTER PIC X char x$ X(1)
Integer INTEGER*4 S9(9)COMP int INTEGER I(9)
Page
2
of
14
Avoiding Pitfalls in Multi
-
7/18/2008
http://www.hp.com/cgi
-
bin/pf
-
new.cgi?IN=http://jazz.external.hp.com/papers/lang/pgm_pi
...