Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recompile modified VCL unit

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

like image 667
hinst Avatar asked May 26 '15 13:05

hinst


1 Answers

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.
like image 102
Ondrej Kelle Avatar answered Nov 15 '22 13:11

Ondrej Kelle