Interlanguage Calls - Rules for Passing Parameters by
The following is an example of a call to a prototyped function:
int i, j; //32 bits each
long k; // 64 bits
double d1, d2;
short int s1;
void f(int, int, int, double, float, char, double, short);
f( i, j, k, d1, f1, c, d2, s1 );
The function call results in the following storage mapping:
- A parameter is guaranteed to be mapped only if its address is taken.
- Data with less than fullword alignment is copied into high-order bytes. Because the
function in the example is prototyped, the mapping of parameters c and s1
- The parameter list is a conceptually contiguous piece of storage containing a list of
words. For efficiency, the first 8 words of the list are not actually stored in the space
reserved for them, but passed in GPR3-GPR10. Furthermore, the first 13 floating point
value parameter values are not passed in GPRs, but are passed in FPR1-FPR13. In all cases,
parameters beyond the first 8 words of the list are also stored in the space reserved for
- If the called procedure intends to treat the parameter list as a contiguous piece of
storage (for example, if the address of a parameter is taken in C), the parameter
registers are stored in the space reserved for them in the stack.
- A register image is stored on the stack.
- The argument area (P1 ... Pn) must be large enough to hold the
largest parameter list.
Interlanguage Calling Conventions
Corresponding Data Types
Use the Subroutine Linkage Conventions in Interlanguage Calls
Sample Program: C Calling Fortran