Any hints for those that want to upgrade from Delphi 7 (and down) to Delphi 2010?

We have created a web page specifically for this very issue.

We have created a web page specifically for this very issue: embarcadero.com/rad-in-action/migration-... There, you can find webpages, documents, webinar replays, etc. Which all cover the issue of migration. The first thing people say is "I have a huge codebase, and migrating to Unicode will take forever" and almost without exception they discover that "forever" really is a much shorter period of time than they originally thought and that the new features of Delphi 2010 make it all worth it.

1 +1. That's a very good description of what happened where I work, and our codebase is definitely a huge one. (We've probably got close to 5 million lines of Delphi code between several different projects.) – Mason Wheeler Apr 30 '10 at 17:29 @Nick -> Are you referring to the "More resources on moving to Unicode" section in that page?

I will take a look. Thanks. – Altar Apr 30 '10 at 20:40.

The biggest problems are with 3rd-party libraries and VCL. If they're not on D2010, it can be painful. The Unicode issue comes up if you are doing calculations with the length of strings or PChar arrays, assuming one byte per character.

You can usually get away with treating everything as old-style AnsiString / AnsiChar. But then you don't get the benefits of Unicode. If you don't have anything that would be hard to do in Unicode, just do everything in Unicode and you'll be much further ahead than if you have to worry about switching back and forth.

Converting code to unicode doesn't take that much time in itself as long as you didn't do anything "funny" with your strings. I converted close to 1m lines of code + the database in less than 2 weeks. The guys at codegear did a very good job at doing it a lot simpler.

Your code might recompile in D2010 without any changes (But with quite a few tons of hints/warnings). The worst problem from the conversion comes from calls to Window's API that were incorrectly done. For exemple, the function GetComputerName that ask you the size of the buffer in TChars(as specified by the API).

In Ansi, TChar = 1 byte, so Length = SizeOf. In Unicode, it's not true anymore. Worse, the call to the API might not fail.It will just overwrite some valid part of memory and will crash just much later.

Oh... And there is also those slight differences between Ansi and Unicode in Windows API. For exemple, the lpCommandLine of the CreateProcess is read-only in the Ansi version, but read/write in the unicode version.So using a constant as parameter worked fine in Ansi, but will crash in Kernel32. Dll in Unicode.

Overall, it depends a lot on the quality of the code you are working with. Bad code might be very hard to port to D2010. Good code should be pretty easy.

And read the resources that Nick Hodges linked to, they are pretty helpful.

For Unicode conversion issues, your best bet to see the problems people have encountered and what others have done is to get Cary Jenson's White Paper: Delphi Unicode Migration for Mere Mortals. Also I'd highly recommend Marco Cantu's "Delphi 2009 Handbook" that describes all the changes in the Major 2009 release that includes Unicode and Generics and more. Much of his Unicode material from that book is in his White Paper: Delphi and Unicode.

While reading the Jensen white paper one should probably ignore sentences like "Once your application is running in Delphi 2009 or later, see what happens when you intentionally add a Unicode character to your database through your user interface. " Or even better, don't ignore them, think about what's wrong with them. – mghie Apr 30 '10 at 23:19 Another gem: "it may turn out that a user entering Unicode data is no less of a problem that a user entering, say, the wrong date.

Garbage in, garbage out. " – mghie Apr 30 '10 at 23:22.

We have upgraded from Delphi 7 via Delphi 2007, 2009 and now 2010! The following are the biggest issues we have found. Threads have changed, with Resume and Suspend being deprecated.

Unicode The structure of projects have changed and are not backwards compatible The structure of dfms have changed and are not backwards compatible Hope this helps.

WOW, WOW, WOW! I knew about all other issues but not about "The structure of dfms have changed and are not backwards compatible". Do you mean that once I have loaded and saved a project in D2010, I can't go back to D7?

– Altar May 1 '10 at 11:19 You can go back - you'll just need to refill project's options. D7 stores options in . Cfg file, D2010 - in .

Dproj file. You want to go back - you delete . Dproj and open .

Dpr/.dpk. – Alexander May 1 '10 at 21:00 I haven't tried to go back, but I recall that you can't open a D2009 DFM in Delphi 7. – Mmarquee May 1 '10 at 21:05 @Mmarquee: That's wrong.

You can open a D2009 DFM in D7; you just get some "property does not exist" errors, which you can tell the IDE to remove. These are for new properties available in D2009 that didn't exist in D7, and the DFM works fine after they're removed. – Ken White May 3 '10 at 12:59 But you can't open the same DFM and use them in both D2010 and D7.

– Mmarquee May 3 '10 at 22:17.

I agree with Chris - the biggest problem in migrating our code to 2010 was getting all of the 3rd party libraries working. A number of them needed minor source edits here and there and had to be installed from the modified source. Still, that said it wasn't more than a day or so of getting things sorted out.

The only other problem we've had moving to 2010 involved one small section of code that went buggy because of a change in the way 2010's ProcessMessages works. It was an old piece of code that probably shouldn't have been written the way it was to begin with (ProcessMessages and Sleep() inside a while loop waiting on an OPC variable change). It worked in 2007 but in 2010 it somehow devoured system messages and locked up the OPC server.

For us it was a small fix, but like Ken said it will likely depend on the quality of code you are porting. 2010 seems a bit less tolerant of poor practice and ugly hacks.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions