I found the following information on Experts Exchange:
+---
|- Add the source unit to your project by pressing shift+F11 or
| clicking Add to project in Project menu.
|- Click Project-Options-Directory/conditional
|- In Unit Output directory select c:\Program Files\Borland\Delphi6\lib
|
|Compile it and it will produce .dcu file in lib path.
+---
So what I did was:
1. In C:\Program Files\Borland\Delphi6\Source\VCL\, copied AxCtrls.pas
to AxCtrls.pas.original, and then made the change to AxCtrls.pas
2. In C:\Program Files\Borland\Delphi6\Lib\, copied AxCtrls.dcu to
AxCtrls.dcu.original
3. File/New/Application
4. Removed Unit1.pas from the project (project is now empty).
5. Saved the project in My Documents\Delphi\DaxFix\DaxFix.dpr
6. Added C:\Program Files\Borland\Delphi6\Source\VCL\AxCtrls.pas to my
project.
7. Set the Unit Output directory to C:\Program Files\Borland\Delphi6\Lib
8. Did "Build Project".
9. Examined C:\Program Files\Borland\Delphi6\Lib and found the updated
.dcu file. Not yet tried building a project with it.
However, since this will be used in a critical production application,
I want to be sure I haven't missed anything out, and am thinking
particularly of the compiler options:
Please could anyone tell me exactly which compiler options should be
enabled and disabled, (a) for compiling a normal DCU to ...\Lib\, and
(b) for compiling a debug DCU to ...\Lib\Debug\
And anything else that might be wrong with the above procedure?
Thanks for any help!
Cheers
Tony
--
Tony Mountifield
Work: to...@softins.co.uk - http://www.softins.co.uk
Play: to...@mountifield.org - http://tony.mountifield.org
Oh dear. I *really* don't recommend that. Always leave the
Borland-provided DCU files untouched.
> |Compile it and it will produce .dcu file in lib path.
> +---
>
> So what I did was:
>
> 1. In C:\Program Files\Borland\Delphi6\Source\VCL\, copied AxCtrls.pas
> to AxCtrls.pas.original, and then made the change to AxCtrls.pas
>
> 2. In C:\Program Files\Borland\Delphi6\Lib\, copied AxCtrls.dcu to
> AxCtrls.dcu.original
Good. I recommend you put it back to the original. Same for the source code.
Copy the unit you wish to change into your project directory and then
use it as though it were just another unit of your project, including
storing the DCU with the DCUs of the rest of your units.
> 3. File/New/Application
>
> 4. Removed Unit1.pas from the project (project is now empty).
>
> 5. Saved the project in My Documents\Delphi\DaxFix\DaxFix.dpr
>
> 6. Added C:\Program Files\Borland\Delphi6\Source\VCL\AxCtrls.pas to my
> project.
>
> 7. Set the Unit Output directory to C:\Program Files\Borland\Delphi6\Lib
>
> 8. Did "Build Project".
>
> 9. Examined C:\Program Files\Borland\Delphi6\Lib and found the updated
> .dcu file. Not yet tried building a project with it.
>
> However, since this will be used in a critical production application,
> I want to be sure I haven't missed anything out, and am thinking
> particularly of the compiler options:
What you've missed is that anything else that uses AxCtrls will need to
be recompiled as well. That's the dange when you start messing with the
provided VCL and RTL units. You'll compiler errors about "Unix X was
compiled with a different version of Y.Z," where X and Y are units and Z
is a type.
> Please could anyone tell me exactly which compiler options should be
> enabled and disabled, (a) for compiling a normal DCU to ...\Lib\, and
> (b) for compiling a debug DCU to ...\Lib\Debug\
The source file already has a handful of compiler settings listed. The
others that could affect compatibility with other code are the following:
$A for alignment of fields in records (irrelevant since the unit
declares no record types)
$B for short-circuit Boolean evaluation (should always be off anyway)
$M for presence of run-time type information on classes that don't
descend from TPersistent. (irrelevant since it declares no published
properties that aren't in descendants of TPersistent)
--
Rob
1 Recompile with ...
"...\Delphi6\bin\dcc32 system.pas -m -y -$D+
The -y option is a 'magic' undocumented option to get the compiler to
compile a system unit"
2 "make sure you don't change anything in the interface section, as
this would make all other compiled .dcu files incompatible."
Much better to call your changed system code a different name and put
that in your using units.
Alan Lloyd
Just to be sure: $B+ specifies _complete_ Boolean evaluation, and
should be off unless you know what you're doing, right?
Groetjes,
Maarten Wiltink
> And anything else that might be wrong with the above procedure?
You'll have to rebuild most of the standard packages as well, in case
they are used by some project or by the IDE. I never updated the Delphi
libraries myself, just to prevent such complications. Dunno what will
happen to the IDE itself (component palette...), when you have to
re-install the updated packages.
Aren't there Makefiles in the Delphi source directory, for rebuilding
the libraries?
DoDi
Yes.
--
Rob
Thanks to all for the various replies!
Well, after quite a bit of experientation, I discovered a few things:
1. The options given above only apply to RTL modules, or perhaps even
only to system.pas, but definitely not to VCL modules.
2. I copied an original VCL source module, AxCtrls.pas, to an empty
directory, and could reproduce a DCU with an identical size to the supplied
one in the Delphi6/Lib directory, and only a few bytes different near the
beginning of the DCU (presumably a compilation timestamp). I used this:
dcc32 -q AxCtrls -$D- -$L-
So this gives me confidence I have found the correct options for compiling
a non-debug VCL DCU.
3. I have not yet been able to find the correct compilation options to
reproduce a debug DCU with the same size as in the Delphi6/Lib/Debug
directory.
dcc32 -q AxCtrls -$D+ -$L+
doesn't make the file quite large enough, and I have also tried various
combinations of -$M+, -$O-, -$Q+, -$R+ and -$W+, but have not succeeded
in hitting the exact size.
Does anyone here know for certain what compiler options were used when
compiling the original Debug DCUs?