[comp.sys.hp] HP-UX Fortran/C Procedure Calling Protocol

billc@wupulm.UUCP (Bill Canning) (06/30/89)

Could someone out there tell me how FORTRAN/9000 expects
functions to return thier values?  Is it in the same
registers that C would return the same type of value,
(e.g., INTEGER*4 returned in register D0 by FORTRAN,
long int returned in reg. D0 in C.)  I am trying to
port some code that is written in both FORTRAN and
C, originally created on Data General equipment.

Any help someone could offer would be greatly appreciated.

Thanks in advance,
Bill Canning
..!uunet!wugate!wupost!wupulm!billc

don@hpfcdc.HP.COM (Don Gourley) (07/05/89)

On the HP9000 Series 300 machines, FORTRAN & C return basic numeric values
in the same register(s):  d0 for 4 byte values & d0,d1 for 8 byte values.
FORTRAN complex values are not returned in registers and it would require
some more detailed knowledge of their representation and calling convention
to interface complex-valued functions with C functions.


*******/  *****************************************************************
***** /_  _ *****    Don Gourley               hplabs!hpfcla!dong         *
**** / / /_/ ****    Colorado Language Lab     dong%hpfcla@hplabs.hp.com  *
*****   /   *****    Hewlett-Packard Comp.                                *
*******/  *****************************************************************