• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2740
  • Last Modified:

Convert Fortran to C++

I have a very big software written in Digital Fortran.  I want to convert it to Microsoft Visual C++ format.  It is OK if converted codes are not object oriented.

Please recommend a good tool to automate the convertion, and if possible please advise in what circumstances that tool will fail.

Thanks,
Audrey
0
lili6420
Asked:
lili6420
1 Solution
 
TheLordCommented:
0
 
DanRollinsCommented:
Hi TheLord,
The experts in this Topic Area have agreed not to post Answers, rather to post only Comments.  That tends to  provide more, and more varied, input for the Asker and enables more Experts to collaborate to solve the problem.

In this case, that is particularly a good idea, since the link that you posted does not answer the question.  In fact, it describes something quite different from what lili6420 requested.  That makes it less than the 'perfect and only' answer that would qualify as an exception to the 'Comments Only' agreement.  So, in the future, please post comments, like everybody else.  Thanks!

-- Dan
0
 
yonatCommented:
you can try f2c - I think it comes with GNU. If not, you can get it at http://www.netlib.org/f2c/ .
You can also check out http://mywebpages.comcast.net/iliareznik/fpc.htm
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
lili6420Author Commented:
I have looked at the web proposed by the Lord, and as well as the f2c program.  It seems to me it doesn't support digital Fortan.  With simple fortran code, the program generated warning without converting to the desired C/C++ codes.

My desired tool is a fully functional tool, probably a commercial tool, which supports digital Fortran.

Thanks.
Audrey
0
 
IainHereCommented:
lili6420,

There is, and could be, no tool that will convert your FTN code into perfect C++ code.  If there was, there would be no need for humans in the coding process (discuss... :-)

I don't think the route you're suggesting is the best one - why rip apart a (presumably) fully functional, tested set of code simply because it isn't in the same language as the rest of your program?

Buy an up to date FORTRAN compiler, such as http://www.compaq.com/fortran/ which integrates nicely into the VC++ dev environment.  Then compile the code as FORTRAN, and call the functions from your C++ code.

If this is not acceptable, then think about what you're asking - you want to convert all of this code automagically into C++ (or C, in which case f2c is the preferred solution, as mentioned above).  If anything fails, you will still want to go back to the original FTN code to work out what it was supposed to be doing.  There is no shame in maintaining some FORTRAN in your project - I even write new FORTRAN code for very specific tasks, where calculation speed is very important.

Of course, this question would very quickly degenerate into a FTN vs C++ thread, which would be fruitless - decide whether it really is essential that you have all of your code in one language.  If it is, use f2c and change the bits you want to (on the whole it does a very good job).  You will now have lots of C in your C++ program, which you call using a slightly different calling convention from the original FORTRAN.  If your objective is to avoid knowing/ hiring anyone who knows FORTRAN, I doubt that you can meet it.

Cheers, and best of luck.
0
 
AxterCommented:
Hi lili6420,
I think you forgot this question.
Can you please remove it from the LOCK Question list by either awarding the points to deserving expert, or rejecting the posted answer.

Thank you
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now