Some note on migrating Delphi code to XE5

Posted by on in Blogs
I've recently been working with a customer who is migrating code from Delphi 5 up to Delphi XE5 and I thought it would be great to share wider some of the links and notes regularly asked for.

The language and IDE has moved on a long way in the recent years since Embarcadero purchased Delphi, C++ Builder and the other RAD Tools from the Borland CodeGear division in 2008, with a much richer modern language than the Delphi of old, including better Generics, Enhance RTTI, Unicode, Multi-platform compilers and the FM Application Framework etc.

There is a good white paper explaining some of the major additions, last updated for XE2, available via EDN that I would recommend to ready for anyone looking to migrate up to newer versions.

One step anyone moving from Delphi 2007 or before will have is navigating the migration to Unicode. Although for most projects this is quite trivial, there is a great set of resources collated on migrating to unicode with Delphi on Malcolm Groves blog.

One change that is required to the source code comes due to the introduction of unit name scoping in XE2. This makes it a lot clearer when developing for multiple platforms what is platform specific and what will work on all platforms. There is a great summary of the unit scope mappings for Delphi available from DocWiki.

reFind helps make it easy

There is a great tool that is shipped with Delphi to help you along the way to automate a lot of the work. The tool is called reFind and it can be found in your Delphi / RAD Studio bin folder; the typically path is

C:\Program Files (x86)\Embarcadero\RAD Studio\12.0\bin

reFind helps migrate source code with the help of a defined set of operations in a file that you run. It can swap unit uses clauses for full unit scopes defined uses (e.g. ActiveX to WinAPI.ActiveX. It also allows you to migrate component properties from one component to another (as in AnyDAC to FireDAC or the BDE to FireDAC conversion)

reFind examples are shipped with the SVN samples. If you go to where the samples were installed (typically) you can find examples for FireDAC that can easily be adapted to other uses.

C:\Users\Public\Documents\RAD Studio\12.0\Samples\Delphi\Database\FireDAC\Tool\reFind

There is a full document on using reFind tool for delphi code updates on docwiki as well. reFind can also be run at a command prompt with /? to get help at run time too.

The one thing that impresses me about using reFind is that it helps remove the human factor from changing lots of code and can make the trivial things automatic.

Gold User, Rank: 19, Points: 169
Product Marketing Manager & Associate Product Manager, InterBase. @DelphiABall


Check out more tips and tricks in this development video: