Previous: Language Differences Up: Portability Constraints Next: Subroutine Names

Mixed-Language Interface

The interface between routines in Fortran and C is a particular porting problem. The Fortran and C language interfaces are fundamentally different. Fortran strings are especially difficult, since there are now six different ways of passing them among the machines the RTL currently supports. Therefore, any subroutine that accepts character strings must have separate interfaces for Fortran and C (called a bridge routine, or a language binding). In addition, the standard calling sequence even for non-string arguments differs in Fortran (pass by reference) and C (pass by value). Although a Fortran-style calling sequence can be simulated in C (which is the way most VICAR routines currently work), it is unwieldy and difficult to manage. Plus, there is no guarantee that simulating the Fortran interface in C will work across all machine architectures. Therefore, all subroutines must have separate C and Fortran calling sequences, with different names. The name issue will be discussed below. Of course, some subroutines only make sense when called from one language, in which case the alternate language binding would not be needed.