Jump to content
Yaron

I need advice on converting a 500k lines 32bit Delphi 7 application to 64bit

Recommended Posts

18 minutes ago, Yaron said:

Most of the strings I use are WideString in order to support Unicode text in Delphi 7, not only that, all of my base visual components are based on the TNT Unicode library (e.g. TTNTForm, TTNTListBox, TTNTStringList, etc),

Well, that could be a problem if those components are not supported on newer Delphi versions. I don't know because I am not familiar with them.

 

If you do need to replace those components you can make substitute components that will allow loading of the project and will give you if not the same then similar functionality.

 

List all the components you need and find appropriate functional replacement from the Delphi version you plan to upgrade. Then create package your own set of components that will have the same names as TNT components and inherit from appropriate components in new Delphi. Then add all the properties they have that might be different. You will also need to hook up and implement appropriate functionality behind those properties, unless they are functionally unnecessary and you just need to have dummy property to allow loading of a project in new Delphi. This set of components and controls will allow you to open the project in new Delphi version and use those as replacement for TNT components without the need to change form dfm files.

 

It is important to make all those preparations on small test project so that you have everything working properly before you move your actual project.

 

Unicode Delphi also has a WideString, so in theory you could keep using it, but if you are using WideString to interact with TNT components you may need to replace those to generic string type in new Delphi instead of introducing WideString properties to your TNT replacement components.

 

 

Edited by Dalija Prasnikar
  • Like 1

Share this post


Link to post

AFAIK, the TNT Unicode Components were acquired by TMS a couple of years ago, but they are tagged compatible up to Delphi 10.2 now: TMS Unicode Component Pack - looks like they are just abandoned.

Edited by Uwe Raabe

Share this post


Link to post
Quote

all my base visual components are based on the TNT Unicode library

I had to remove a lot of TNT components during my conversions.   I would start your conversion in Delphi 7, made sure all your forms are saved as text, then use a text editor to globally replace TNT components one form at a time in PAS and DFM, with standard VCL versions, so it builds, but won't run properly.  Then open in a modern compiler.  Maybe change WideString to UnicodeString, or perhaps you have an alias already. 

 

Angus

 

Share this post


Link to post
2 hours ago, Yaron said:

all of my base visual components are based on the TNT Unicode library (e.g. TTNTForm, TTNTListBox, TTNTStringList

Are those components compatible with the standard VCL component? I mean does they has same methods, properties and events. If they do, you can just substitute TTNTListBox by TListBox etc...

It is easier to use an interposer class :

TTNTListBox = class(TListBox)

end;

On the long term, once it works, do a global search and replace is .pas and .dfm to get rid of TTNTListBox and similars.

 

Share this post


Link to post
7 hours ago, Yaron said:

Most of the strings I use are WideString in order to support Unicode text in Delphi 7

Just note that WideString is very inefficient in general, since it is an ActiveX/COM string type managed by the OS, not the Delphi RTL.  But you also said a lot of your strings are UTF-8, and you can't store UTF-8 in a WideString.  But you can use UTF8Encode()/UTF8Decode() to convert strings between UTF8String and WideString as needed.

7 hours ago, Yaron said:

not only that, all of my base visual components are based on the TNT Unicode library (e.g. TTNTForm, TTNTListBox, TTNTStringList, etc), so I can't even load the project without getting lots of error messages and I'm not even sure if the TNT Unicode library is compatible with Delphi 10.3

I doubt it, and if I'm not mistaken, TNT isn't even around anymore.  Not to mention it is largely unnecessarily anyway, as the core Delphi classes are now Unicode capable since 2009.  So many/most of the TNT classes you are using can be replaced with the native RTL/VCL counterparts (TForm, TListBox, TStringList, etc).

7 hours ago, Yaron said:

which means I have to revert 1000's of work-arounds for unicode text that I've implemented over the years.

Hard to say without seeing your actual code, and what kind of workarounds you are using.

7 hours ago, Yaron said:

My code also uses quite a bit of ASM optimized code for Audio DSP, graphic processing, etc.

You can still use ASM coding in modern Delphi, although 64bit does have some additional restrictions on its usage.

Share this post


Link to post
7 hours ago, Yaron said:

My code also uses quite a bit of ASM optimized code for Audio DSP, graphic processing, etc.

Take care that on 64 bit you cannot mix pascal code and asm code and that the parameters of a method will be passed differently with respect to 32 bits (the conventions for passing through registers change):
for example a 64-bit integer as a function result in a 32-bit app will be passed as EDX:EAX while in a 64-bit app it will be passed as RAX.

Also, the asm code should be rewrite. No mix between 32 bit asm and 64 bit asm should be done. Of course 32 bit registers may be accessed, but not all 64 bit instructions are available to do the same as 32 bit with 32 bit register.

Edited by DelphiUdIT

Share this post


Link to post
3 hours ago, Remy Lebeau said:

TNT isn't even around anymore.  Not to mention it is largely unnecessarily anyway, as the core Delphi classes are now Unicode capable since 2009.

It's as necessary as it always was if you are using a pre Unicode Delphi. And yeah it's still around. Code doesn't vanish. Why would anyone develop it for compilers that aren't developed?? 

Share this post


Link to post
19 hours ago, Lajos Juhász said:

To replace them you can simply use the refind utility

Or if you use GExperts anyways, use the "Replace Components" expert.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×