Unicode to AnsiString conversion

Giganews Newsgroups
Subject:Unicode to AnsiString conversion
Posted by: Clive Walden
Date:Mon, 27 Sep 2010

Assuming no Unicode specific characters.

Moving from Delphi7 to Delphi2010 I am going to continue to rely on some old third party DLLs that came with Delphi access units that wrap the DLL calls.
Obviously the DLLs are expecting AnsiString types so would I be correct in doing the following or is there a better approach?

1. Replace all references to String etc. in the Delphi access unit to AnsiString etc.
2. Cast all my function and procedure call parameters to AnsiString.
i.e. doSomething(AnsiString(stringparam));

On a related issue, is it time to start thinking about the arrival of a 64 bit compiler and change code variables that require a 4 byte integer to LongInt or Longword declarations?

Replies