Mixed-Language Issues

HomeOverviewHow Do I

This section reviews basic concepts of mixed-language programming, and introduces relevant new Win32 features. For example, the __stdcall keyword replaces the fortran and pascal keywords in C modules. Another important aspect of Win32 is that all addresses are the same size, simplifying pass by reference. Thus, you may want to review this section even if you have written mixed-language programs extensively for MS-DOS.

Mixed-language programming is possible with Microsoft languages because each language implements functions, subroutines, and procedures approximately the same way. The following table shows how different kinds of routines from each language equate to each other. For example, a C main program could call an external void function, which is actually implemented as a Fortran subroutine.

Language Equivalents for Calls to Routines

Language Call with return value Call with no return value
Assembly language Procedure Procedure
C and C++ function (void) function
Fortran FUNCTION SUBROUTINE

In this family of articles, the term “routine” refers to functions, subroutines, and procedures from different languages. This definition does not include macros or inline functions, which are not implemented using the stack.

There are some important differences in the way languages implement these routines, however. This article family presents a series of keywords, attributes, and techniques to reconcile these differences, which fall into three categories:

In addition, you need to reconcile differences in the way individual data types (strings, arrays, common blocks, and so on) may be treated. This important and complex topic is discussed in Handling Data Types in Multiple Languages.