Fortran was the world’s first procedural programming language, and it brought with it a whole host of improvements to the art and science of programming. It made it easier than ever before to translate mathematical ideas into machine language. However, since its release in 1957, many other language have come to the fore, and it has remained in use only for limited purposes. Visual Basic is a programming language that is pervasive on Microsoft’s operating system and programs, so integrating Visual Basic code is often much easier than integrating Fortran code. As a result, you may find it useful to translate old Fortran programs into Visual Basic to promote future maintainability. SUBROUTINE mySubroutine(a, b, c) REAL :: a, b, c END SUBROUTINE The same subroutine in Visual Basic would look like this: Sub mySubroutine(a As Double, b As Double, c As Double) End Sub As you can see, the beginning and ending code does not significantly change, but REAL becomes Double and is applied to each argument individually, instead of all of them at once. INTEGER FUNCTION plus(a, b) INTEGER :: a, b plus = a + b END FUNCTION plus The same function in VB.NET would look like this: Function plus(a As Integer, b As Integer) As Integer Return a + b End Function The return type, which is expressed before the FUNCTION keyword in Fortran comes at the end of the Function line in Visual Basic, and the argument types move from inside the function body to the Function line (just like with subroutines). The return value, which is expressed in Fortran as an assignment statement (using ‘=’) whose left-hand value is the name of the function itself, is expressed in VB.NET using the Return statement (without any equals sign). You may find that some of the library functions do not have direct equivalents–every language has a different set of strengths and weaknesses. If this occurs, you will need to write your own Visual Basic function to reproduce the behavior of the Fortran function. To make sure you understand and are accurately reproducing the Fortran function’s behavior, make sure you refer to the Fortran documentation. You can download Intel’s Fortran documentation at http://www.intel.com/software/products/compilers/techtopics/for_prg.htm Warnings Writer Bio

How to Convert Fortran to Visual Basic - 44