Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How hard is it to migrate a project from Delphi 7 to Delphi XE?

Our company have a software that has been in development for over 10 years, so there are some really dated stuff in there. It's still quite functional and everything, but I see the new features on Delphi XE and it makes me want to switch. Problem is that the source code itself is over 300mb of .pas files (1gb total with components, etc).

We're using custom components, old jvcl stuff and the latest devexpress.

How hard can I expect things to be if I decide to migrate from Delphi 7 to Delphi XE?

Thank you.

like image 507
Rosenberg Avatar asked Apr 17 '11 16:04

Rosenberg


2 Answers

The only real problem is conversion to Unicode. You should learn how Unicode support is implemented in Delphi - start from Marco Cantu White Paper: Delphi and Unicode

It is impossible to estimate the amount of work required to upgrade old applications to Unicode without knowing the actual code. If you were using string types in the standard way, the conversion would be easy. Any low-level tricks with string types (like storing binary data in strings) are now deprecated and the correspondent code should be rewritten.

like image 101
kludg Avatar answered Sep 19 '22 23:09

kludg


Some small tools either migrate without needing to do any modifications, or just a couple of unicode fixes to get it to run.

However, if your codebase is as huge as you're explaining, you shouldn't completely rely on what anyone here is going to tell you. Just get a copy of XE and load the code. See what problems you run into to get a feel for the amount of effort it's going to take.

At this moment I've ported all of my code to XE (even old projects). I re-use the same libraries as much as possible, so once I've converted most of those, "porting" applications from Delphi 7 to Unicode Delphi's was usually merely a repetitive task to either deal with updated interfaces in the libraries, or to fix compiler errors and warnings.

Most common errors that I've encountered:

  • Unicode stuff. This will take 90% of the time. It's annoying if the code does a lot of low-level string handling, but most of the problems can easily be fixed by adding some typecasts.

  • the compiler bitches when you use c in ['a'..'z']. You're supposed to use CharInSet() for unicode strings.

  • If you set ShortDateFormat, you'll get a compiler warning that you should use FormatSettings.ShortDateFormat instead. In new code that's a good idea. If you're porting, just ignore it initially if you just want to get going.

Additionally, you'll probably upgrade your third party libraries to newer versions, so that you don't have to port those yourself. It's not uncommon for those to have changed their interfaces or workings, so i'd download some trial versions of those to see what has been changed.

like image 43
Wouter van Nifterick Avatar answered Sep 19 '22 23:09

Wouter van Nifterick