Interlanguage Calls - Call by Value Parameters
In prototype functions with a variable number of arguments--
specified with an ellipsis, as in function(...)-- the
compiler widens all floating-point arguments to double precision.
Integral arguments (except for long int) are
widened to int. Because of this widening, some
data types cannot be passed between Pascal and C without explicit
conversions, and Pascal routines cannot have value parameters of
certain data types.
The following information refers to call by value, as in C. In
the following list, arguments are classified as floating values
or nonfloating values:
- Each nonfloating scalar argument requires 1 word and
appears in that word exactly as it would appear in a GPR.
It is right-justified, if language semantics specify, and
is word aligned.
- Each float value occupies 1 word, float doubles occupy 2
successive words in the list, and long doubles occupy
either 2 or 4 words, depending on the setting of the the -qldbl128/-qlongdouble
option.
- Structure values appear in successive words as they would
anywhere in storage, satisfying all appropriate alignment
requirements. Structures are aligned to a fullword and
occupy (sizeof(struct X)+3)/4 fullwords, with any padding
at the end. A structure smaller than a word is
left-justified within its word or register. Larger
structures can occupy multiple registers and can be
passed partly in storage and partly in registers.
- Other aggregate values are passed val-by-ref; that
is, the compiler actually passes their addresses and
arranges for a copy to be made in the invoked program.
- A function pointer is passed as a pointer to the
routine's function descriptor. The first word contains
the entry-point address. See Pointers to Functions
for more information.
![](../../images/ngrelt.gif)
Interlanguage Calling Conventions
Corresponding Data Types
Using the Subroutine Linkage Conventions
in Interlanguage Calls
Sample Program: C Calling Fortran