Recompile modified VCL unit
Asked Answered
M

1

6

I have to compile my project with a changed VCL unit. I use Delphi XE8. I copied Vcl.StdCtrls.pas from D:\Program Files (x86)\Embarcadero\Studio\16.0\source\vcl to my project folder where my .dpr file is localed, then I changed my copy of Vcl.StdCtrls.pas. I also added this unit to project tree. The problem is that with Delphi XE8 such method of recompiling VCL units no longer works. I put an obvious syntax error in my modified Vcl.StdCtrls.pas unit. Compiler does not report the error which means it does no even check the file. I always do a full build Shift+F9. I found a similar question How to recompile a specific unit from the VCL? but like I said, it no longer works, not for Delphi XE8.

Also, the modified unit is on my uses list in .dpr file:

uses
  Vcl.StdCtrls in 'D:\Dev\MYPROJECT\Vcl.StdCtrls.pas',
  ...

// it does not help

Meliamelic answered 26/5, 2015 at 13:22 Comment(4)
I simply do not believe that this is true.Sabo
It may be worth asking why you wish to do this. It is entirely possible that there is a less fragile solution to the fundamental problem you are trying to solve.Arnuad
...for instance class interposing...Encompass
related: #10471443Culhert
N
7

This seems to be a bug. I guess you're using runtime packages. In XE7 such project will not compile - which is the correct behavior. In XE8 it compiles, apparently using the VCL runtime package and ignoring your modified unit.

Edit:

Note that even in previous Delphi versions, modifying a VCL unit while using runtime packages would still require you to repackage the modified packages and their dependencies (in this case, vcl and rtl). In other words, you cannot simply use a modified unit while linking against a runtime package which contains another copy of that unit. Unit names must be unique within the full scope of the project, including the main executable and all linked runtime packages.

So the solution for you is to either:

  1. not use runtime packages, or
  2. repackage all required units into your own runtime packages, and link against them instead of Embarcadero-supplied rtl, vcl etc.
Norseman answered 26/5, 2015 at 13:46 Comment(8)
Presumably not compiling at the point where the unit name is encountered because that unit is already in a dependent package. So even the correct unit would not compile.Sabo
@DavidHeffernan Yes, I would assume that as well.Norseman
It's probably worth pointing out to the asker that you cannot replace a unit from a package without rebuilding the package. So what the asker has attempted has never been possible.Sabo
And also note that the license says you can/should not replace an Embarcadero provided unit without renaming it.Region
@RudyVelthuis I couldn't find anything like that in the license. Can you provide a reference? I've been using modified unrenamed VCL units internally in my projects for many years, without distributing them.Norseman
You never answered the question " why you wish to do this"Bor
@Encompass "well, but did someone ask that in this thread ". Yes.Bor
@TLama: I can't find it right now. I guess if you don't disitribute, it is not necessary. But it is and has always been recommended by Borland and later Embarcadero. Also see: #7085541.Region

© 2022 - 2024 — McMap. All rights reserved.