Reputation: 40140
Is there any way to take an old Borland C++ (v6) project and convert it to Delphi (v7, or maybe XE if that helps, but preferably D7)?
I seem to recall that BCB could compile Pascal, but not the other way around. In any case, I want to hand the project off to someone who knows no C++ but does know Delphi in order to extend it.
I do not want to keep any old C++ code, just convert everything to Delphi - manually if I must.
Hope you can save me some time ...
Upvotes: 1
Views: 5954
Reputation: 585
We recently found ourselves in the same situation : lots of legacy C++ Builder applications, it would take years to convert it all by hand.
So I wrote a little perl script that helps a lot with the conversion. It's not 100%, that would be impossible, but it does most of the conversion for you. It's free to download and use any way you want. Have a look here : http://copycat.fr/wordpress/porting-old-cbuilder-software-to-new-versions/
Upvotes: 2
Reputation: 68892
Auto-convert? NO. If you're fearing having to do it all yourself, but are willing to do that anyways, then yes, I can confirm for you that there are no silver bullets and you'll have to do it all manually.
At this point, if you were willing to keep some C++ code around, I'd recommend you do so:
The UI could be built in C++ with C++Builder, and the model (logic code) could stay C++, and also be built in C++Builder.
If you wanted to rewrite the UI in delphi, it would not be too hard to have it load up the C++ parts (which would be compiled into a DLL or BPL library) and call them at runtime.
Note that loading up and calling C++ code from Delphi apps is not hard, and that C++ Builder and Delphi are basically two flavors of the same thing, since C++ Builder is really just a way to write your app in C++ while using a Delphi/pascal UI framework (the VCL) underneath.
So consider either C++Builder (part of RAD Studio) or a Delphi+C++ hybrid, as a complete rewrite of a non-trivial app would take a really long time. But yes, you can rewrite anything into anything else, given enough time. But do you really want to?
If your eventual goal is 100% pure Delphi but you wanted to get a partial conversion done first, then finish the conversion later, you could do it in stages if you wanted to; Link in some C++ parts, load them from DLLs, or even statically link the .obj files into your delphi app.
It seems you are dead set against C++. I am a long time C++ hater. If that's your deal, I understand.
But let's not be hasty here; It might not be terribly hard to convert an old Borland C++ OWL library codebase to a modern Visual C++ Codebase using MFC/ATL, either, although IMHO, MFC/ATL are crap. Consider also, if you should port to QT/C++ or wxWidgets/C++ (you could go cross-platform and get a version that runs on the Mac, and on Linux that way!). There are so many options for UI, while staying on C++, and that would be certainly easier than manually rewriting the whole thing in a completely different language (Pascal or Python, or C# or Java, really, all the same amount of effort: About as long as it took to write it all in the first place!). I love pascal, and I prefer it to C++ about 100 times. If anything, I'm biased too much in Delphi's favor. But complete rewrites are almost never practical, and AUTO-CONVERSIONS are also a pipe dream. Modern C++ is actually a pretty nice language. Why rewrite your codebase?
Upvotes: 5