Solved

Convert Fortran to C++

Posted on 2002-06-22
6
2,704 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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Windows Script Host (WSH) has been part of Windows since Windows NT4. Windows Script Host provides architecture for building dynamic scripts that consist of a core object model, scripting hosts, and scripting engines. The key components of Window…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now