• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1799
  • Last Modified:

Upgrade from D7 to Delphi XE

Hi,
before to move fully to VS, I have to upgrade a lot of source code to the newest Delphi version.(Reasons: Windows 7,UTF8,...)
And I am waiting for the XE next month.
I have some questions:

1. What is your expierence (with 2009,2010) ? Is it easy to upgrade the existing source codes?
2. Is there something like guidance (patterns) or it is not necessary?
3. What should I be aware of?

Thanks.
0
mottor
Asked:
mottor
  • 7
  • 6
  • 5
  • +1
2 Solutions
 
epasquierCommented:
The main problem you will encounter is the fact that all strings are now Unicode.
So codes using String, Char and PChar with the implicit knowledge that a Char is a Byte might not work anymore.
These codes are usually fixed by replacing :
String => ANSIString
Char => ANSIChar
PChar => PANSIChar

Some codes could be made to work with all delphi version by adapting to the Char size automatically.
Ex :

Procedure CopyPCharString( Src,Dst:PChar; NbChars :Integer);
begin
 Move ( Src^ , Dst^, NbChars * SizeOf(Char) );
end;

in the above example, the original code was considering that a Char takes 1 byte. By adding the multiplication by the size of Char, it will work as well in Delphi 7 and Delphi 2009 (where sizeof(Char)=2 )

That is the kind of problems you'll encounter
0
 
mottorAuthor Commented:
>>  PChar => PANSIChar

What is with the calls to Windows API. I am converting usually string to PChar.
I will make PChar to PANSIChar, but don't want to change string to ANSIString.
How are they defined in Windows.pas?
0
 
epasquierCommented:
All the windows API in Windows.Pas exist in 2 versions, one with 'A' suffixe and one with 'W' suffix, for ANSIString and WideString. You can use those explicitly to be sure of the type used.

But usually, your old programs, and your new ones, will use the third version, which is an alias, without suffix, and depending on the Delphi version it will point to the 'A' version (Delphi<2009) or the 'W' version (Delphi >=2009)

One example out of many :
function CreateMutex(lpMutexAttributes: PSecurityAttributes; bInitialOwner: BOOL; lpName: PChar): THandle; stdcall;
function CreateMutexA(lpMutexAttributes: PSecurityAttributes; bInitialOwner: BOOL; lpName: PAnsiChar): THandle; stdcall;
function CreateMutexW(lpMutexAttributes: PSecurityAttributes; bInitialOwner: BOOL; lpName: PWideChar): THandle; stdcall;

Open in new window

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Geert GruwezOracle dbaCommented:
if you're very lucky, not a lot of work
if you're not lucky (75% change), you'll have a lot of work

nick hodges posts a lot of articles concerning this:
http://edn.embarcadero.com/article/38437
http://edn.embarcadero.com/article/38498

i found this as a reference to upgrading to unicode
http://www.embarcadero.com/images/dm/technical-papers/delphi-unicode-migration.pdf

from bob swart's site
0
 
DragonSlayerCommented:
Oh, and it's fun to be able to play with generics, hope you will enjoy that too! :-)
0
 
epasquierCommented:
Generics, yeah ! that is one useful feature of newest Delphi.
Like templates in C++
Since someone introduced them to me I can't wait the time when I'll be able to upgrade.
0
 
mottorAuthor Commented:
Thanks,

Will I have problems by migration with DOA,DevExpress and FastReport components?

Regards
0
 
Geert GruwezOracle dbaCommented:
if you use the QuantumTreeview v4
you'll have to upgrade it to v5 in D2010
Quantumgrid v6 wasn't a problem
I don't have other components of DevExpress

DOA ???

Don't have FastReport either
0
 
Geert GruwezOracle dbaCommented:
ah got it ... DOA = Dead On Arrival   :)
0
 
Geert GruwezOracle dbaCommented:
for the other DOA (if you are referring to devart.com components)
no problem either
0
 
epasquierCommented:
Delphi XE is not out yet, so it's difficult to tell the extent of the problems you'll have with it.

But from experience with Delphi versions migrations, you will have to get the latest version of all the components you use, check on their websites if they even have a Delphi XE version ready.
Anyway, probably any components that have been certified with Delphi 2009 will present no problems, as it was the biggest step.

With components that don't have a newer version ready, if you have the source code you might just be able to recompile them without much work. Some will probably need a few tweaks here and there to work again.
And last, we cannot remove the possibility that some old and unmaintained components will pose more than a trouble.
0
 
Geert GruwezOracle dbaCommented:
one thing that keeps hitting me about XE ... those letters

Oracle XE > Free
MSSQL  XE > Free
Delphi XE > ??? ... probably not, as it's not a database product :(
0
 
epasquierCommented:
I've read in embarcadero site that XE stands for nothing. Just one of those marketing brilliant ideas - supposed to make the mass go for it without question because it's "cool". Yeah, whatever....
For XP, they found after some sort of definition "eXPerience". Maybe someone will come up with something for XE :o)
0
 
mottorAuthor Commented:
DOA is from Allround Automations

About XE is better to say nothing.  (Have learned in the past.)

Thanks for the help.

I will write here after the migration
0
 
mottorAuthor Commented:
>>Qualifying products for all XE Enterprise upgrades
>>Any Architect, Enterprise or Professional edition of: Delphi 2007-2010
>>C++Builder 2007-2010
>>Delphi and C++Builder Bundle 2009
>>RAD Studio 2007-2010
>>Upgrade product is also available on valid promotional upgrade offers
>>For a limited time, through Dec 31, 2010, registered users of  Borland Developer Studio 2006, C++Builder 2006, and Delphi 2006 also  qualify for upgrade pricing
I'm not eligible for upgrade. May be the question was for no purpose.
I have to rethink, if I should give 1999 Euro + VAT

I thank you anyway :)
0
 
epasquierCommented:
> I have to rethink, if I should give 1999 Euro + VAT
maybe you don't need enterprise edition and professional is just enough ?
0
 
mottorAuthor Commented:
>maybe you don't need enterprise edition and professional is just enough ?

I have asked them, if I buy Pro and it is not enough, kann I upgrade to Enterprise.
The answer was NO.
I wanted to test with trial version. But there is not such (Pro).
0
 
mottorAuthor Commented:
I have found better solution for Delphi 7 Enterprise owner (me):
Embarcadero® All-Access™ Pass Silver with 1 Year Membership - Single Platform Upgrade

At least you get ER/Studio. I hope that is not a trap. :)
0
 
mottorAuthor Commented:
I've bought Embarcadero® All-Access™ Pass Silver.
Today I have successfully upgraded the first small application. It was easy.
Thank you.

P.S. The exe size has grown from 19MB to 22MB. Is this normal?
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 7
  • 6
  • 5
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now