Andy’s Blog and Tools

Syndicate content
Delphi, C++Builder and other thoughts
Updated: 33 weeks 3 days ago

System.ByteStrings support for XE5 Update 2

Fri, 12/20/2013 - 14:10

XE5 Update 2 broke the Android System.ByteStrings.o file. So I recompiled it with XE5 Update 2 and now you can use the Byte-Strings (UTF8String, AnsiString, RawByteString, ShortString) also with XE5 Update 2.

The unit System.ByteStrings reintroduces:

  • ShortString
  • AnsiString
  • AnsiChar
  • PAnsiChar
  • PPAnsiChar
  • UTF8String
  • PUTF8String
  • RawByteString
  • PRawByteString

Add the System.ByteStrings.dcu’s path to the compiler’s search path and add the unit to your uses clauses.

There is no *.PAS file because the DCU is patched with a hex editor to get access to the hidden types.
Name IDE Version File Size Downloads Added System.ByteStrings XE5 RTM/UP1 only XE5ByteStrings.7z 2.45 KB 456 times 2013-10-23 System.ByteStrings XE5 UP2 only XE5Up2ByteStrings.7z 2.85 KB 254 times 2013-12-20

Categories: News, Blogs, and Tips

IDE Fix Pack 5.4.1 – Support for XE5 Updater 2

Wed, 12/11/2013 - 12:13

IDE Fix Pack 5.4.1 adds support for the just released XE5 Update 2.

If you use the older version 5.4 with XE5 Update 2 you will see one or two error messages (depending on if you have the x64 compiler installed) that tell you that one patch couldn’t be applied to the x86 and x64 compiler. This is caused by a small change in the code generator of the compiler that is used to compile the Delphi compiler. It now generates a “mov cl,[edi+$0c]” instruction where it used to generate “mov dl,[edi+$0c]” since Delphi 2010.

IDE Fix Pack 5.4.1 for XE5 now supports both instructions so that you can use it with XE5 RTM, Update 1 and Update 2. All other IDE Fix Pack editions for 2009-XE4 are still on version 5.4 as the only change happened for XE5.

Name IDE Version File Size Downloads Added IDE Fix Pack 5.4 2009+UP3 173.75 KB 650 times 2013-11-01 IDE Fix Pack 5.4 2010 159.74 KB 894 times 2013-11-01 IDE Fix Pack 5.4 XE 147.68 KB 1043 times 2013-11-01 IDE Fix Pack 5.4 XE2+UP4+HF1 217.09 KB 1488 times 2013-11-01 IDE Fix Pack 5.4 XE3+UP1 213.54 KB 963 times 2013-11-01 IDE Fix Pack 5.4 XE4 214.72 KB 1076 times 2013-11-01 IDE Fix Pack 5.4.1 XE5 213.41 KB 1732 times 2013-12-11


Name IDE Version File Size Downloads Added fastdcc 5.4 2009+UP3 fastdcc2009v54.7z 75.4 KB 185 times 2013-11-01 fastdcc 5.4 2010 fastdcc2010v54.7z 79.34 KB 236 times 2013-11-01 fastdcc 5.4 XE fastdccXEv54.7z 81.36 KB 302 times 2013-11-01 fastdcc 5.4 XE2+UP4+HF1 fastdccXE2v54.7z 104.53 KB 352 times 2013-11-01 fastdcc 5.4 XE3+UP1 fastdccXE3v54.7z 116.06 KB 279 times 2013-11-01 fastdcc 5.4 XE4 fastdccXE4v54.7z 107.91 KB 300 times 2013-11-01 fastdcc 5.4.1 XE5 fastdccXE5v54.1.7z 108.92 KB 372 times 2013-12-11

Categories: News, Blogs, and Tips

CLANG, template debuginfo and linker out of memory

Sun, 12/08/2013 - 05:47

The CLANG compiler that is used for BCC64 in XE3, XE4 and XE5 has a “bloated object file” problem if it comes to debug information for deeply nested templates. The generated object file can easily grow to 100 MB with a single line of code.

int main(int argc, char *argv[]) { std::map<TEnumA, std::map<TEnumB, std::map<TEnumC, std::map<TEnumD, std::map<TEnumE, std::map<TEnumF, std::map<TEnumG, std::map<TEnumH, std::map<TEnumI, std::map<TEnumJ, std::map<TEnumK, std::map<TEnumL, std::map<TEnumM, char* > > > > > > > > > > > > > Dummy; Dummy[TEnumA::TEnumAVal1][TEnumB::TEnumBVal1][TEnumC::TEnumCVal1][TEnumD::TEnumDVal1][TEnumE::TEnumEVal1][TEnumF::TEnumFVal1] [TEnumG::TEnumGVal1][TEnumH::TEnumHVal1][TEnumI::TEnumIVal1][TEnumJ::TEnumJVal1][TEnumK::TEnumKVal1][TEnumL::TEnumLVal1] [TEnumM::TEnumMVal1] = "Booooom!"; return 0; } .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }

The problem comes from creating a debug information string for template arguments in the method TemplateSpecializationType::PrintTemplateArgumentList in clang/lib/AST/TypePrinter.cpp. If you have deeply nested templates like the one above, all the code and declarations that std::map brings with it, creates really long debug information strings (600,000 chars and more). And with CLANG’s ability to be helpful in finding template errors, it also records the original template name of a typedef’ed template parameters and creates a debug information string that containing the original template name everywhere where the typedef is used.

The code above creates so many huge debug information strings that the object file becomes over 100 MB large. Depending on the number of such template instantiations in your code, the file can easily become larger than the available RAM. But that isn’t necessary to get the out of memory. The linker (ilink64) will run out of memory even with this “little” 100 MB object file.

The easiest but unpractical solution is to disable debug information.

With the next IDE Fix Pack there is another solution. IDE Fix Pack hooks into the compclang.dll and shortens the strings. If the number of chars exceeds 2048, every further template parameter will be replaced by “…”. That makes those strings not only much smaller but the compiler will also generate the debug information much much faster because there is less recursion and less string concatenation.

I can only guess why the linker runs out of memory with a 100 MB object file. I assume that it does some unfortunate memory allocations for the debug information. But after finding a solution to shrink the debug information in the object file, I didn’t need to look into the linker.

Categories: News, Blogs, and Tips

DDevExtensions 2.8 released (2009-XE5)

Thu, 11/14/2013 - 14:28

The DDevExtensions 2.8 version is a bug fix release that also adds support for RAD Studio XE5.

  • Version 2.8 
    • Added: XE5 support
    • Fixed: Shift+Ctrl+Alt+Up/Down didn’t work
    • Fixed: Fonts used in DDevExtensions dialogs were a mixture of MS Sans Serif and Tahoma on a per Control base


Name IDE Version File Size Downloads Added DDevExtensions 1.61 5-2007 734.07 KB 14918 times 2009-01-10 DDevExtensions 2.7 Features PDF DDevExtensionsFeatures.pdf 595.28 KB 2953 times 2013-06-06 DDevExtensions 2.4 7, 2007 535.41 KB 6056 times 2011-07-25 DDevExtensions 2.8 2009-XE5 DDevExtensions28.7z 815.06 KB 2670 times 2013-11-14 DDevExtensions 2.6 (legacy) XE2+UP3 800.68 KB 139 times 2013-11-28

Categories: News, Blogs, and Tips