Technical data

Fortran/C Wrapper Interface
43
varargs macro va_alist appearing at the end of the parameter name list and
its counterpart va_alist appearing at the end of the parameter type list. In the
case above, use of these macros would produce the function header
#include "varargs.h"
func1 (carr1,i,str,j,carr2,va_alist)
char carr1[], *str, carr2[];
int i, j;
va_dcl
{}
The C routine could retrieve the lengths of carr1 and carr2, placing them in
the local variables carr1_len and carr2_len by the following code fragment:
va_list ap;
int carr1_len, carr2_len;
va_start(ap);
carr1_len = va_arg (ap, int)
carr2_len = va_arg (ap, int)
Using mkf2c and extcentry
mkf2c understands only a limited subset of the C grammar. This subset
includes common C syntax for function entry point, C-style comments, and
function bodies. However, it cannot understand constructs such as typedefs,
external function declarations, or C preprocessor directives.
To ensure that only those constructs understood by mkf2c are included in
wrapper input, you need to place special comments around each function
for which Fortran-to-C wrappers are to be generated (see example below).
Once these special comments, /* CENTRY */ and /* ENDCENTRY */, are
placed around the code, use the program excentry(1) before mkf2c to generate
the input le for mkf2c.