PDA

View Full Version : Using legacy code with .NET


R. T. (Fortran Man)
08-13-2003, 04:52 PM
I have a legacy program that I want to convert to the .NET compiler. What are the first steps that I need to take?

Lahey Support
08-13-2003, 05:03 PM
1) Try compiling the code with the Fortran for .NET compiler, using the -ncs option. The -ncs option indicates that names are not case sensitive. It is likely that the code will compile without problems if it previously compiled without problems.

2) Next, evaluate how you want to use the code and to what extent you want to integrate it into the .NET scheme. The possibilities range from keeping the code as close to original as possible and calling it from wrappers, to converting it into Fortran 2000-style, object oriented class libraries. Either way, the code will be available for use as code behind Windows or Web forms, COM objects, etc.

3) If you want to interoperate with the .NET Framework directly from your code, you need to ensure that all variable names are case sensitive. Remove the -ncs option from the compile command, add an IMPLICIT NONE statement to the code, and recompile. This will find inconsistencies in the case of variable names. Once all the variables have a consistent case, you are ready to interoperate with the Framework, or do whatever else you want to do in the .NET world.