Solved

Convert Fortran to C++

Posted on 2002-06-22
6
2,716 Views
Last Modified: 2013-11-08
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
Comment
Question by:lili6420
6 Comments
 

Accepted Solution

by:
TheLord earned 200 total points
ID: 7101467
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7109699
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
 
LVL 5

Expert Comment

by:yonat
ID: 7129970
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
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:lili6420
ID: 7130152
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
 
LVL 4

Expert Comment

by:IainHere
ID: 7131553
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
 
LVL 30

Expert Comment

by:Axter
ID: 7147460
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question