Solved

Upgrade from D7 to Delphi XE

Posted on 2010-08-25
19
1,765 Views
Last Modified: 2012-05-10
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
Comment
Question by:mottor
  • 7
  • 6
  • 5
  • +1
19 Comments
 
LVL 25

Assisted Solution

by:epasquier
epasquier earned 200 total points
Comment Utility
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
 
LVL 4

Author Comment

by:mottor
Comment Utility
>>  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
 
LVL 25

Expert Comment

by:epasquier
Comment Utility
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
 
LVL 36

Accepted Solution

by:
Geert Gruwez earned 300 total points
Comment Utility
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
 
LVL 14

Expert Comment

by:DragonSlayer
Comment Utility
Oh, and it's fun to be able to play with generics, hope you will enjoy that too! :-)
0
 
LVL 25

Expert Comment

by:epasquier
Comment Utility
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
 
LVL 4

Author Comment

by:mottor
Comment Utility
Thanks,

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

Regards
0
 
LVL 36

Expert Comment

by:Geert Gruwez
Comment Utility
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
 
LVL 36

Expert Comment

by:Geert Gruwez
Comment Utility
ah got it ... DOA = Dead On Arrival   :)
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 36

Expert Comment

by:Geert Gruwez
Comment Utility
for the other DOA (if you are referring to devart.com components)
no problem either
0
 
LVL 25

Expert Comment

by:epasquier
Comment Utility
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
 
LVL 36

Expert Comment

by:Geert Gruwez
Comment Utility
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
 
LVL 25

Expert Comment

by:epasquier
Comment Utility
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
 
LVL 4

Author Comment

by:mottor
Comment Utility
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
 
LVL 4

Author Comment

by:mottor
Comment Utility
>>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
 
LVL 25

Expert Comment

by:epasquier
Comment Utility
> I have to rethink, if I should give 1999 Euro + VAT
maybe you don't need enterprise edition and professional is just enough ?
0
 
LVL 4

Author Comment

by:mottor
Comment Utility
>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
 
LVL 4

Author Comment

by:mottor
Comment Utility
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
 
LVL 4

Author Comment

by:mottor
Comment Utility
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now