OK, so I haven’t tried it, so there was a big disclaimer.
In the help viewer, browse the topic (Unicode in RAD Stufio). ms-help: //embarcadero.rs2009/devcommon/unicodeinide_xml.html
When returning a Delphi 2007 string to Delphi 2009, you should get two problems.
Firstly, the code page mentioned by Rob. You can set this by declaring another AnsiString and calling StringCodePage in the new AnsiString. Then assign it to the old AnsiString by calling SetCodePage. That should work, but if that doesn't happen, there is hope.
The second problem is the size of the element, which will be something completely insane. It should be 1, so do it 1. The problem here is that there is no SetElementSize function to rely on.
Try the following:
var ElemSizeAddr: PWord;
That should do it!
Now, if the StringCodePage / SetCodePage object does not work, you can do the same as above by changing the line where we get the address to subtract 12 instead of 10.
He has hacked inscriptions, so I love him.
In the end, you will have to port these DLLs, but this makes the port more manageable.
One final word - depending on how you return AnsiString (function result, output parameter, etc.), you may need to first assign a string to another AnsiString variable to make sure there is no need to overwrite memory.
source share