HP-UX Fortran/C Procedure Calling Protocol

Mike McNelly mike at hpfcdc.HP.COM
Thu Jul 6 01:23:05 AEST 1989


> 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.

C and FORTRAN share the same calling conventions on HP-UX 9000 Series
300 but you have to remember that C is normally call by value and
FORTRAN is normally call by reference.  Function values are returned in
the same registers.

For your porting effort, I'd strongly suggest that you pick up two HP
manuals:  1) HP-UX Portability Guide for HP 9000 Series 300/800
computers (Part Number 98794-90046), which discusses a lot of language
porting issues such as data type sizes and alignments, features, etc.;
and 2) HP-UX Assembler Reference and Supporting Documents (Part Number
98597-90020)m which discusses calling code conventions for the
languages.  These are detailed discussions.

Mike McNelly
mike%hpfcla at hplabs.hp.com



More information about the Comp.lang.c mailing list