Convert Fortran to C#

  • Thread starter Thread starter David Dvali
  • Start date Start date
D

David Dvali

Hello.

I have one small program which I need to convert in C#.
The original source codes are written in Fortran 77.
Can anybody advice me what is the easy way to do this task?
Or may be there is some tools for it?

Thank you.
 
I have one small program which I need to convert in C#.

Csharp is object oriented.
The original source codes are written in Fortran 77.

This is a procedural language
Can anybody advice me what is the easy way to do this task?

There is no easy way but it should not be too hard since you can test
your program versus the Fortran compiled one..
 
My suggestion: create a procedural C# app by creating an app with a single
class. In your fortran app, each function call becomes a public method of
the class. The global variables become class-level variables (that you
create in your constructor). Create a 'main' method for the main function
in your Fortran app.

Then, if your project is a win-form app, have one of your controls create
this object and run the main method. If your project is a console app, have
the console app simply create the object and run the main method.

Input and output will be your biggest issues. Depending on how flexible you
want your app to be, I'd suggest you create a pair of interfaces, for an
Input object and an Output object. In your constructor, pass in objects
that implement the input and output interfaces. That way, you can change
how the input and output works by changing the object you pass in, without
affecting the Fortran app.

Note that Fortran was pretty specific about the way it performed math
operations. If your particular Fortran app does math operations, test
carefully (especially boundary conditions) to make sure that your C# app
operates in the same way. Look carefully at the data types that you use to
represent the values you are calculating. That can change the semantics of
math functions.

Hope this helps,
--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top