?
Solved

Upgrade from D7 to Delphi XE

Posted on 2010-08-25
19
Medium Priority
?
1,791 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 6
  • 5
  • +1
19 Comments
 
LVL 25

Assisted Solution

by:epasquier
epasquier earned 800 total points
ID: 33523553
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
ID: 33523616
>>  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
ID: 33523739
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 38

Accepted Solution

by:
Geert Gruwez earned 1200 total points
ID: 33524404
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
ID: 33525164
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
ID: 33525920
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
ID: 33566002
Thanks,

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

Regards
0
 
LVL 38

Expert Comment

by:Geert Gruwez
ID: 33566243
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 38

Expert Comment

by:Geert Gruwez
ID: 33566249
ah got it ... DOA = Dead On Arrival   :)
0
 
LVL 38

Expert Comment

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

Expert Comment

by:epasquier
ID: 33566344
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 38

Expert Comment

by:Geert Gruwez
ID: 33566646
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
ID: 33566699
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
ID: 33567276
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
ID: 33567863
>>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
ID: 33569056
> 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
ID: 33574938
>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
ID: 33594545
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
ID: 33829631
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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month10 days, 2 hours left to enroll

762 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