Delphi 2011 (XE)

Delphi XE (aka Delphi 2011) was released late 2010 and looks to be a great version with over 1000 big fixes included and adds a number of handy new features including:

  • new support for services development and Amazon EC2 deployment
  • Subversion Version Control
  • FinalBuilder Embarcadero Edition
  • AQtime Standard for profiling your app
  • Beyond Compare Text Compare to help manage code changes
  • CodeSite Express for enhanced debugging
  • New components for Microsoft Windows Azure data types
  • full version of /n software’s IP*Works components
  • New DataSnap features including creating servers using Delphi, new wizards, RESTful server support, encryption, compression, and new client options to extend the capabilities of your multi-tier applications
  • access to earlier versions Delphi, including Delphi 2010, 2009, 2007, and 7
  • RAD Studio XE also includes C++Builder XE, Delphi Prism XE and Delphi PHP XE

My experience of converting Delphi 2007 code to RAD Studio XE:

  1. install RADStudio XE – I prefer to install it to c:\DelphiXE rather than the default program files folder so path lengths are more manageable.
  2. run Delphi XE to ensure all is working fine, consider changing Projects folder to a local folder (eg. c:\DelphiXE\Projects) in Tools:Options:EnvironmentVariables:BDSPROJECTSDIR and add an Overide.
  3. make a copy of your older code and code libraries
  4. to help solve Unicode issues, DO NOT adopt the option of using the Unicode converter program to do a basic code conversion for Unicode data types (eg. converts string to AnsiString, etc) on all your code folders as this will cause much work to undo and defeats the purpose of making your app Unicode capable. AnsiString in QuickReport parameters will result in unprintable characters. Many Delphi/Windows functions require String as parameters not AnsiString.
  5. install any components your code requires – NB. QuickReports Standard is no longer included, so you will need to buy the pro version if you need this, and if you use legacy formless reports, see here.  Consider 3rd party report component sets such as FastReports or Report Builder.
  6. open your projects and see if it will compile – you may need to fix issues with Delphi functions or procedures which expect or return Unicode variables. For example, chr now returns a unicode Char not an AnsiChar.
  7. you may need to add TEncoding parameters to certain procedures such as SaveToFile
  8. you will need to change pos(substr, str) to AnsiPos if str is a Unicode string.
  9. remember TStringField for datasets is an AnsiString not Unicode (you need to use TWideStringField for Unicode)
  10. replace if x in [‘A’..’Z’] with if Character.isUpper(x) to avoid compiler warning or use if CharInSet(x,[‘A’,,’Z’]) although this officially recommended method is controversial.
  11. check your code if it uses SizeOf or FillChar, if using a string as a data buffer, use array of Bytes instead.
  12. if you use DBX connections to MS SQL, you will need to use the new dbxdriver.ini file and DBX drivers, and update the parameters of your TSQLConnection string, plus deploy the new dbx driver (and ensure the client machine has the MS SQL Client native drivers installed – not the oledb drivers). You can avoid deploying dbxdriver.ini and dbxconnection.ini by adding the relevant DBXxxxx.pas unit to your Uses clause where xxxx = SybaseASE or MSSQL or Oracle, etc. BUT you must not have an older dbxdriver.ini and dbxconnection.ini file (eg. for Delphi 2007) in your executable folder or path as this will be referenced instead creating errors such as “Multi OLEDB error” due to incompatible parameters. Note the new DBX drivers which need to be referenced in params and deployed on client machines if you don’t add the DBXxxx to Uses clause.
  13. Likewise, avoid deploying midas.dll by adding MidasLib to your Project Uses clause.
  14. if you pass emptyParam OLEVariant to COM functions, you will now get an incorrect variable error unless you use Variants.EmptyParam instead, and add Variants to Uses clause.
  • Delphi 2007 Olectrls.pas has this declared at the start which works:
  • var
    { Hack: the compiler does not support default parameters for variant types. }
    EmptyParam: OleVariant;
  • Delphi XE and I presume Delphi 2009 onwards, has removed this and added a function which returns Variants.EmptyParam of type OLEVariant. For some reason, this no longer compiles unless you replace all instances of EmptyParam with Variants.EmptyParam.
  • I managed to successfully have my fairly complex and large D2007 app upgraded, converted, compiled and running apparently smoothly with about 6-8 hours of mainly unicode conversion work but although it compiled it still needed lots of testing to eradicate changes to the application introduced by Unicode.

Registration and more downloads:

  • once you have installed RAD Studio XE, and have registered it, you can then log in to Embarcadero Developer Network (EDN) and download:
    • Delphi Prism, Delphi PHP
    • older versions of Delphi including 7, 2007, 2009, 2010.
    • various updates.

JCL and JVCL libraries:

  • the JCL library has been updated for Delphi XE Update 1 compatibility – look for version JCL 2.2 Build 3970 released in Jan 2011.
  • Once JCL library is installed, reboot computer, then install the latest JVCL library (JVCL340CompleteJCL221-Build3845) which can be downloaded here

Optional customisations and free 3rd party controls:

No comments yet.

You must be logged in to post a comment.

No trackbacks yet.