Enhanced Run Time library for Delphi 7
Purpose of these files is to provide speed and bug corrections to the Run Time Library and the VCL of Delphi 7.
Original Source code remains on following copyright:
Copyright (c) 1988, 2001 Borland Software Corporation
A.Bouchez disclaims copyright to the modifications made to the
In place of a legal notice, here is a blessing (from SQLite3 licence):
May you do good and not evil.
May you find forgiveness for yourself and forgive others.
May you share freely, never taking more than you give.
2. InstallationThese files are hacked low-level source code, extracted from the original Delphi 7 run time libray and VCL.
In order to install them, you MUST have a true Delphi 7 installation in your
PC (or at least the original Delphi 7 installation CD), then launch the
SynopseRTL.EXE file. This file will check for the original Delphi 7 source
files and ask for a destination folder. Keep the destination Directory name
short (aka D:\Dev\Lib) for easy maintenability. Then launch syscomp.bat to
compile the enhanced special System.dcu and SysInit.dcu files.
The expected file and date of the Delphi 7 Source files are September 2002, October 2002, or April 2004.
According to Borland/CodeGear/Embarcadero copyright, the original source files are needed: these installation packages only contain the diffs made to these files.
- for the IDE, make sure that the new directory (e.g. D:\Dev\Lib) is the
FIRST in all paths ("Library" tab of the global Options), before $(DELPHI)\Lib:
a valid parameter is "d:\dev\lib;$(DELPHI)\Lib;$(DELPHI)\Bin;...." or
- for the command line compiler, change the dcc32.cfg -u flag content in the C:\Program Files\Borland\Delphi7\Bin directory into this: -ud:\dev\lib;"C:\Program Files\Borland\Delphi7\lib" or use a custom bat file file the proper -ud:\dev\lib command line to dcc32.exe
These files could be modified to enhance also newer version of Delphi, since the RTL files didn't change a lot until Delphi 2009 compiler version.
These files are not needed for the Synopse SQLite3 framework to compile. But with these modified files, the framework works even better.
If you don't want to hack your compiler, copy System.dcu and SysInit.dcu files into the source code directory of your project: the IDE will use it to build the executable.
Update: now the files were modified to run with Delphi 2007.
3. System.pas enhancements- included John O'Harrow version of move() fillchar() Pos() Val() and Int64 math
- included Pierre Le Riche fast _LStrCmp() implementation
- deprecated Japan Nec computer bug prevention under Win95 is removed
- shortstring delete() copy() now use move() and not slow "rep movsb/movsd"
- borland memory manager is removed and replaced with windows heap manager: we recommend using FastMM4 explicitely for VCL applications (as Delphi 2009), and leave as it is for smaller executables (e.g. for LVCL; the windows heap manager is slower than FastMM4, but sufficient for GUI small apps)
- there is an optional integrated FastMM4 memory manager inside our getmem.inc, which can be enabled by undefining HEAPMEMMANAGER conditional in getmem.inc: this FastMM4 shares its memory for the same process with external .DLL (if both EXE and DLL are compiled with undefined HEAPMEMMANAGER conditional)
- some common functions implemented in asm: _Getmem, _Freemem, IOResult...
- very common internal basic methods rewritten or improved: TObject.NewInstance, TObject.InitInstance, TObject.InheritsFrom, TObject._AfterConstruction, TObject.GetDynaMethod (used a lot in the VCL), TObject.ClassName...
- on new multi-core CPU, avoid LOCK asm usage for strings and dynamic arrays if no TThread is used (default $define AVOIDLOCK): faster with high-end PC, since such a LOCK freezes all the cores and delay the code execution a lot
- record and object initialization and finalization rewritten for speed: _InitializeArray, _FinalizeArray, _InitializeRecord, _FinalizeRecord functions
- cached resourcestring (default $define LOADRESSTRINGCACHED)
- resourcestring can be translated on the fly with the global LoadResStringTranslate procedure pointer (this feature is used in the SQLite3i18n unit)
- cached widestring allocation (if the conditional $define CACHE_WIDESTRINGS is set): with Vista, the caching is always disabled, since this OS is much faster than the previous) but you must call explicitly InitWideStringOptimize to launch caching, in order to use the right heap manager (if you intend to use FastMM4 e.g.
- asm code: 'rep ret' optimization avoid modern CPU pipeline branch misprediction; see AMD64 document § '6.2 Two-Byte Near-Return RET Instruction', page 128
- asm code XOR reg32,reg32 + MOV reg8,* is changed to faster MOVZX reg32,*
- a special version is compiled with the LVCL define flag, for even smaller code; you can download the LVCL framework in LVCL.zip
- Linux/Kylix compatibility:
. can be compiled with the command-line compiler (tested with crosskylix)
. system codepage is fixed to ISO-8859-1: widestring is available with configuration like LANG=*.UTF-8, which is the standard nowadays for modern distros
4. SysUtils.pas enhancements- NormToLower and NormToUpper tables to fast character case conversion
- TwoDigitLookup table for fast 0..99 to '00'..'99' conversion
- HexChars for fast 0..15 to '0'..'f' conversion
- Ansi*() functions use NormToLower and NormToUpper: call i18n unit and i18n*() functions for using current locale
- some common functions are faster than default Borland's implementation: CompareText() SameText() UpperCase() IntToStr() DecodeTime() DecodeDate() StrLen() StrComp() StrIComp() StrEnd()
- avoid use of slow PIC specific code or lodsb/stosb asm opcodes in asm for format() and such
5. Classes.pas enhancements- faster TReader.Read() and TCustomMemoryStream.Seek()
- faster TList.Get(), TCollection.GetItem() and TStringList.Get()
- under Linux, avoid variants usage for speed up and code size
6. Contnrs.pas enhancements- faster TObjectList TComponentList TClassList Items read property
7. ComCtrls.pas enhancements- fix the VCL TDateTimePicker checkbox handling bug for Windows Vista
8. Grids.pas enhancements- fix Grid flickers with active theming
- can use XP Themes for fixed cells if enabled
9. Printer.pas enhancements- allows raw customization of low level parameters:
. create a TPrinterNew instance instead of a TPrinter
. access to color/black&white or duplex mode e.g. with PrinterNew function
. we have to subclass TPrinter inside this unit, because Borland made the key properties and methods of the class private
10. IniFiles.pas enhancements- faster hash implementation (in asm)
- round Hash buffer Size to a power of two (faster hashing calculation)