Creating a debug version of the vcl package

Posted by on in Blogs

Ever have a package-based application that has been affected by a bug in the VCL? If so, you'll know how difficult it can be to hunt it down. I had one recently, so I began searching for exactly how to debug into the VCL source when using packages. Oddly, I found very little info on the subject. Fortunately, I found enough info and knew enough myself already to achieve it. Here's how, as it applies Delphi 7. For other versions of Delphi, use the corresponding suffix, eg 50 for Delphi 5, 60 for Delphi 6 etc, in place of 70. 

1. Start a new package, by clicking File|New|Other, select the “Package” icon and click OK.
2. Click File|New|Form
3. Press Ctrl-F9 to compile the package. The package will compile with warnings, and present a dialog with changes necessary to your package, namely adding a reference to vcl. Click OK to accept the changes, and Delphi will add the reference, and finish compiling the package.
4. In the “Requires” branch of the package, double click the reference to vcl. It will take a while to generate, so be patient. Note that Delphi automatically generates the list of units that the package contains.
5. Press Ctrl-S to bring up the Save dialog. You will need to give the package a name other than vcl.dpk. I chose to name mine vcl70.dpk. You'll be able to change it back in a later step. Save the package somewhere appropriate.
6. Click the “Options“ button in the package editor, select the “Description” tab and change the LIB suffix value to: 70. Select the “Compiler” tab, and check the “Use debug DCUs” checkbox.
7. Click File|Save As and change the name of the package to vcl.dpk
8. Close Delphi
9. In the Windows System32 directory, rename vcl70.bpl to vcl70.borl.bpl. In the Delphi Lib directory, rename vcl.dcp to vcl.borl.dcp
10. Copy the following files from the Delphi Lib directory to the Delphi LibDebug directory

11. Bring up a command prompt (eg click Start|Run, type cmd and press enter), and change directory to where you saved the vcl.dpk package
12. Use the following command to compile the package:
    dcc32 vcl.dpk
13. Copy the resulting vcl70.bpl to the Windows System32 directory, and copy the resulting vcl.dcp to the Delphi Lib directory.

That completes building the debug vcl package. You'll need to rebuild the packages in your project that use the vcl so that you can debug into the vcl source.

Tags: Delphi stuff


  • Guest
    Chris Saturday, 18 February 2006


    This is the only place on the web that I have found instrucitons on rebuilding the VCL for Delphi 7.

    However... havng followed these steps I just end up with Delphi unable to start and giving an access violation until I put the original vcl70.bpl files back in place.

    Any suggestions on what might be causing that type of problem? - I am trying to rebuild the vcl because of a bug in the xpman use, which is causing an error 216 on closing my delphi apps.

    Any suggestions much appreciated (apart from upgrade to latest delphi release, as that is not currently an option for me!)



  • Guest

    [...] Dave Nottage offers a simple solution for Delphi 7, but this doesn't seem to work with RAD Studio 2007 and up. [...]

  • Guest
    Doug Woodrow Friday, 5 October 2012

    Many thanks Dave, this is very useful. One thing though: I tried to do the same in order to build rtl.dcp, and the rtl.dpk created by Delphi references 2 units not supplied with Delphi: VarHlpr and StrHlpr.
    I've found the source on as part of the OpenCLX project; are they actually required for Win32 applications?

  • Guest
    Adi Zarfaty Wednesday, 14 November 2012

    I found a simpler solution -
    create a package with debug info from the compiled DCUs and use that instead in the rest of the project of including the delphi units. works great.

  • Guest
    php development services Wednesday, 7 May 2014

    this is very useful post for me,, its really informative

  • Please login first in order for you to submit comments
  • Page :
  • 1

Check out more tips and tricks in this development video: