Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

Mixed-Language Programming

Mixed-language programming is the process of building programs in which the source code is written in two or more languages. It allows you to:

  • Call existing code that is written in another language.

  • Use procedures that may be difficult to implement in a particular language.

In mixed-language programming, a routine written in one language calls a function, procedure, or subroutine written in another language. For example, a Fortran program may need to call an existing shared library or system procedure written in another language.

Although mixed-language programming is possible between Intel® Fortran and other languages, the primary focus of this section is programming using Intel® Fortran and C. Mixed-language programming between these languages is relatively straightforward for these reasons:

  • Fortran implements functions, subroutines, and procedures in approximately the same way as C.

  • Fortran provides many standard features to improve interoperability with C. An entity is considered to be interoperable if equivalent declarations are possible in both languages. Interoperability is provided for variables, derived types, and procedures. For more information, see Standard Fortran and C Interoperability.