Building the Mixed-Language Program

OverviewHow Do I

In Win32, the choice of libraries is much simpler than it is in 16-bit environments. Consequently, it is easier to build a mixed-language program. To link C and Fortran modules, use the Fortran linker; the linker should find the correct default libraries.

For example, the simple console applications featured in other articles in this family require no special options. The CMAIN application can be created with the following commands:

cl /c cmain.c
fl32 cmain.obj forsubs.for

The FORMAIN application can be created with the following commands:

cl /c csubs.c
fl32 formain.for cmain.obj

Multithread applications should have full multithread support, so if you use LIBFMT.LIB, make sure that LIBCMT.LIB is specified as a default library as well.