The F77 macros and CNF functions described in this document provide a complete way of writing portable programs in a mixture of FORTRAN and C. All of the work necessary to provide the correct interface goes into writing the C routines. It is relatively painless to call C from FORTRAN, since the work of writing the interface need only be done once, but it can be annoying to have to write a lot of extra code every time that a FORTRAN routine is called from a C one. As mentioned in More on Calling FORTRAN from C (Section 8), it may be appropriate to write wrap-around routines when calling FORTRAN from C.
Another package that tackles the problem of mixing C and FORTRAN is one called CFORTRAN, written by Burkhard Burow of the University of Toronto. This will be available as part of the CERN library and could be provided on Starlink if required. This package allows you to write an interface layer between a user’s code and a subroutine package such that neither side need be aware that the other is written in a foreign language. This is a crucial difference from the F77 macros, where the C code is written in the full knowledge that the function is being called from, or is to call, a FORTRAN routine. It is certainly possible to write a package that can be called either from FORTRAN or C using the F77 macros, but this does not occur automatically.
When using CFORTRAN, an extra level of subroutine call is always involved over what is strictly necessary using the macros described in this document. This results in less efficient code. However, when this is not a serious problem, there may be situations in which it is more appropriate to use the CFORTRAN system in preference to F77.