How to recompile a specific unit from the VCL?
Asked Answered
K

3

9

I want to apply a fix from QC to a Delphi 2009 unit (DBClient as it happens). I know I need to copy the unit to another directory and make the change to the copy. How do I then get Delphi to compile that unit and use it in favour of the DCU that already exists?

Kenwee answered 28/6, 2009 at 14:20 Comment(2)
I posted a similar question (with possible solution) here: #78152820Zounds
related: #10471443Zounds
G
16

If you don't want to modify the original .Pas file, I do this by copy the .Pas file into my application folder, then choose built project, it will create new dcu file in my application folder, which will be used instead of the original one.

Geordie answered 28/6, 2009 at 14:29 Comment(2)
Beware that this won't work if other VCL units depend on the changed one, in that case they need to be recompiled as well. Otherwise linking the application will fail.Cardin
And it won't work if you use runtime packages and watch out with 'Use Debug DCUs'Publish
N
4

It's kind of a last resort (and not supported by CodeGear), but I do something similar to Mohammed when necessary. Except instead of putting any modified units into the application folder, I put them into their own folder with the rest of my library code and include this folder in my library path where it will be used by all of my projects. It also prevents me from having multiple (possibly slightly different) copies hanging around.

I also make a point of checking any updates to see what has changed so I can either remove the modified units or re-apply the changes to the newer (and presumably better) units from CodeGear.

Neldanelia answered 17/7, 2009 at 19:2 Comment(0)
M
-2

I've never did this myself but there are projects in {RAD}\source\rtl along with batch build script. I believe this makes recompiling RTL functions easy. Other units should be recompiled easier.

If the changes you want to do are local and the units aren't widely used by other RTL/VCL units, the simplest way is to place copies of modified units separately from their standard place.

Another option is run-time patching aka detouring.

Mastership answered 29/1, 2016 at 14:44 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.