Fortran and C# .NET Interop explained
February 3, 2024 ยท View on GitHub
This repository contains documentation and example code on how to make Fortran interoperate with the .NET framework.
An introduction to the strange world of mixed language programming with FORTRAN and C# .NET code
- Introduction to FORTRAN interopability with .NET
- Exchanging complex data
- ISO C Binding module
- Callbacks and strings (unfinished)
- Mixed mode assemblies (unfinished)
Example code
The example code is complete and covers all topics, including callbacks, strings and mixed mode assemblies. The example code is comprised of:
- Interop.f90 contains the Fortran code.
- The FortranInterop folder containing the Visual Studio solution.
- FortranInterop project demonstrating PInvoke
- FortranGlue project demonstrating a Mixed mode assembly
- FortranInteropTests proving both integrations using unit tests
References
Fortran Wiki on interoperability
The articles and example code were initially published at Codeproject.com.
- Introduction to FORTRAN Interoperability with .NET
- FORTRAN Interoperability with .NET: Exchanging Complex Data
- FORTRAN Interoperability with .NET: ISO C Binding module