Re: FORTRAN common blocks
Eric S Fraga <ucecesf@ucl.ac.uk> writes:
>
> All arguments are passed by reference in Fortran.
To be pedantic, only *explicit*, non-array arguments are passed by
reference.
For example, when passing a character string, the pointer is passed by
value and there is an implicit string length which is also passed by
value.
This is shown in this C wrapper for the CERNLIB subroutine HBOOK1:
void hbook1(int id, char *title, int nbins, float min, float max)
{
void hbook1_(int*,char*,int*,float*,float*,float*,int) ;
float vmx = 0.0;
hbook1_(&id, title, &nbins, &min, &max, &vmx, strlen(title));
}
Here, "hbook1_" is the mangled symbol name of the actual FORTRAN
subroutine HBOOK1. BTW, this mangling depends on the FORTRAN compiler
and what options were given but trailing underscore is common for g77.
-Brett.
Reply to: