Previous: Mixing Fortran and C Up: Mixing Fortran and C Next: Naming Subroutines

Bridge Routines

The calling interface for the language a subroutine is written in will be straightforward. You simply have to adhere to the rules for that language. The interface for the other language will typically be implemented via a ``bridge'' routine, which must be written in C.

This bridge routine accepts arguments in the format of the opposite language, and converts them to the form of the language the subroutine is written in. It then calls the main subroutine. For example, a subroutine written in C would have a bridge also written in C that would accept arguments in the Fortran style, reformat them, and call the main C subroutine. A subroutine written in Fortran would have a C bridge that accepts C-style arguments, and calls the Fortran subroutine in the proper manner.

rgd059@ipl.jpl.nasa.gov