How do the new string types work in Delphi 2009/2010?

前端 未结 5 737
我在风中等你
我在风中等你 2020-12-24 03:51

I have to convert a large legacy application to Delphi 2009 which uses strings, AnsiStrings, WideStrings and UTF8 data all over the place and I have a hard time to understan

5条回答
  •  天命终不由人
    2020-12-24 04:48

    Another thing to watch out for when passing string between dlls built with different versions of Delphi or C++ Builder is that, starting with 2009, the StrRec part of AnsiStringBase gained two extra fields; codePage and elemSize. They are 2 bytes each (short ints), so the size of StrRec is now 12 bytes instead of 8. This can cause invalid pointer exception problems with memory allocation and destruction, even when the data part of the string seems to transfer ok.

提交回复
热议问题