Technical data
Fortran/C Wrapper Interface
41
character array When using mkf2c to call C from Fortran, the address of the
Fortran character variable is passed. This character array
can be modified by C. It is not guaranteed to be null
terminated. The length of the Fortran character variable is
treated differently (as discussed in the next section).
pointer The value found on the stack is treated as a pointer and is
passed without alteration. Any array or pointer that is not
of type char, any parameter with multiple levels of
indirection, or any indirect array is assumed to be of type
pointer. If the type of a parameter is specified but is not one
of the standard C types, mkf2c will pass it as a pointer.
Below is an example of a C specification for a function:
test (i,s,c,ptr1,ar1,u,f,d,d1,str1,str2,str3)
short s;
unsigned char c;
int *ptr1;
char *ptr2[];
short ar1[];
sometype u;
float f;
long float d, *d1;
char *str1;
char str2[],str3[30];
{
/* The C function body CAN go here. Nothing
except the opening and closing braces are
necessary */
If this function were passed to mkf2c, the parameters would be transformed
as follows:
• PTR1, PTR2, AR1, D1, and U would be passed as simple pointers.
• mkf2c would complain about not understanding the type SOMETYPE
but, by default, would assume it to be of type POINTER.










