Interlanguage Calls - Rules for Passing Parameters by Value

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;
float f1;
short int s1;
char c;
...
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:

Notes:

  1. A parameter is guaranteed to be mapped only if its address is taken.
  2. 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 is right-justified.
  3. 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 them.
  4. 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.
  5. A register image is stored on the stack.
  6. 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