hcOPF - Installing with the Package Generator

I just updated the hcOPF package generator.  This project is a utility I started work on in order to simplify the maintenance of hcOPF packages.  It’s far to time consuming to update the packages for all Delphi compilers supported every time I make a change to the one I’m working on.  If they get out of sync, it becomes a nightmare for someone unfamiliar with the framework to resolve.  I looked at the Jedi package generator, but it’s a complex beast with support for C++ Builder, which I don’t need.

I also considered building an installer based on the MustangPeak component installer, but that’s on hold for the moment as I simply don’t have enough hours in the day.

My KISS solution was to chop up the DPK into three files suffixed  by what they contain (contains, requires, and directives).  The PackageGenerator application uses only native delphi controls so you should be able to compile it with any Delphi version you want.

The UI is pretty simple.

The hcOPF Package Generator

The hcOPF Package Generator

You select one or more compilers for which you want to generate current packages.  You must set the root compiler folder path so the application can find the subdir for each compiler version supported in which to save the generated files.  The default is “Z:\hcOPF\Compilers”.  I recommend using a short path and creating an environment variable in Delphi to point to the folder off of the root of the drive.  My environment variables are as follows:

hcOPF = $(HD)\hcOPF
HD = Z:

This way, I can change the drive mapping, or the root folder of the hcOPF framework and I don’t have to change any of my Library Paths  (the hcOPF packages also use the $(hcOPF) environment variable so defining $(hcOPF) is mandatory):


The following paths should be added to your Browsing Path:


This means trying hcOPF should be as simple as:

1) Configure your delphi environment as described above.  That means creating an hcOPF environment variable, and populating the Library and Browing Paths as described.

2) Get the source from SVN.  Here are some instructions on how to use the SVN client to get the source.

3) Run the PackageGenerator - an EXE is in the Bin folder even though everyone should be able to compile the source.

4) Install the TPerlRegEx component.  The hcOPFValidators package requires this component for RegEx validation.  I have defined an interface so it’s possible to use your own RegEx evaluator if you wish.

5) Select the compiler you want to generate current packages for, and click the Generate button.

6) Open the AllPackages.bpg file in the target compiler directory for the compiler you selected.  For instance, if you checked D11 (Delphi 2007) then open the AllPackages.bpg file in \trunk\Compilers\D11.  In this case, Delphi uses MSBuild so it will upgrade the packages, creating the necessary XML files.  That is why the Clean Target Directories option is checked by default.

7) Select the first package in the group (HengenOPFCore.dpk) and Rt. Click - select Build All from Here

8) Rt. Click on each package from top to bottom that starts with ‘dcl’ and select Install

You should now have hcOPF installed and be able to compile the Demos (use the Delphi 7 projects as I have not yet updated the projects for other compilers.  I might actually adapt the PackageGenerator code to do that for me).

I have tested the output of the package generator with Delphi 2007 since I recently migrated my current project so I can compile under either Delphi 7 (yes I still use it as my primary IDE), and Delphi 2007.  If you have any issues, comments, or suggestions, let me know.

I did recently discover that versions of Delphi that use MSBuild do not preserve the DCU Output folder when upgrading the project.  Be sure to change the folder to ‘..\..\Lib\D??’ where  ?? represents the Delphi version.  I may change the package generator to generate DPROJ files.

Tags: ,

12 Responses to “hcOPF - Installing with the Package Generator”

  1. Norldir Kunkel Says:

    Not found .obj files from TPerlRegEx. (download it from site and reinstall)

    dclHengernOPFGui fail because file hcLabelVisibleMediator.dcu was not found. Solution: Add it to HengenOPFGUI.dpk

    DevExpress requirement…..

  2. Norldir Kunkel Says:

    At file boPerson.pas

    on class procedure TAddress.Register;

    line : aRequiredString30 := ThcStringValidator.Create(MetaData);

    [Error] boPerson.pas(78): Too many actual parameters
    [Error] boPerson.pas(84): Too many actual parameters
    [Error] boPerson.pas(90): Too many actual parameters
    [Error] boPerson.pas(137): Too many actual parameters
    [Fatal Error] fmEditAddress.pas(7): Could not compile used unit ‘boPerson.pas’

    At: file fmEditAddress.pas:

    [Fatal Error] fmEditAddress.pas(52): File not found: ‘hcStdMediators.dcu’

  3. Larry Hengen Says:

    I have resolved all of these issues except for the one concerning TPerlRegEx. One of the prerequisites of the hcOPFValidators package is this component. The full source is under /trunk/3rdParty/TPerlRegEx although you will have to install the component manually yourself. I have confirmed resolution by performing a clean build, but if I have missed anything else, please let me know.

  4. Enrico Says:

    When I try to install dclHengenDevExpressGUI, it claims the cxExtEditorsD14.bpl is missing. I have RAD Studio 2010.

    The ADO library is missing the function FieldByName in the StoredProc and Query component

    Best Regards,

  5. Larry Hengen Says:


    If you’re getting an error compiling the ADO library it’s likely that you’re missing the $(hcOPF)\Source\Include path from your Library path. This directory contains Delphi.inc which defines all directives relating to the version of Delphi. I amended this post to include it. Please confirm that it resolves your issue.

    As for the missing cxExtEditorsD14.bpl that is quite understandable. The OPF packages containing DevExpress require the Developer Express Grid Suite which is a popular commercial product that can be found at http://www.devexpress.com/Products/VCL/ExQuantumGrid/. You do not require this to use hOPF. It is made available for developers who are using DevExpress, or wish to, just as the reporting package contains support for ReportBuilder.

  6. wangwei Says:

    when I open person demo,
    [Fatal Error] fmEditAddress.pas(52): File not found: ‘hcStdMediators.dcu’
    where can I find it?
    thank you!

  7. slim Says:

    when i try to instal the dclhangenADOLayer120.bpl i had the strange message “the declaration of ‘FieldByName’ is different from that in the interface ‘IhcQuery’ and the same message when trying to instal the dcHangenIBXLayer120.bpl.
    PS: i have Delphi2009 (D12).

  8. Larry Hengen Says:


    The problem is that the definition of TADOQuery.FieldByName has changed between Delphi versions and unless you have each version you don’t know when what changes were made. The definition of TADOQuery.FieldByName must match the definition used by hcQueryIntf which contains the function definition wrapped with a number of conditional defines.

    {$ifdef D5_UP}
    {$ifdef D11_UP}
    {$ifdef D15_UP}
    function FieldByName(const FieldName: string): TField;
    function FieldByName(const FieldName: WideString): TField;
    function FieldByName(const FieldName: string): TField;

    It should be attempting to use the one in bold. Apparently this is the wrong prototype for D12. I would modify the directives so the appropriate prototype is used and recompile all the packages. That should resolve the issue.

    Please send me any changes you make so I can incorporate it into the SVN version.

  9. slim Says:

    First install the jcl component
    In thirdparty directory replace all files in the TPerlRegEx directory with files in this urls.
    in « HengenOPFGUI » package replace VCLjpg by VCLIMG for details you can see this url :
    Before the seven step “Select the first package in the group (HengenOPFCore.dpk) and Rt. Click - select Build All from Here », in Delphi 2009, we change “widestring” in hcQueryIntf unit by “string” (the one in bold).
    Now we have hcopf instelled in delphi2009.
    but i still have a problem when I attempt to compile the person example, I had the message “unavailabale database”, I think that the problem is that IBX is not compatible with the 2.5 firebird server, because when I test the database with another component (fibplus) I don’t have a problem.

  10. Larry Hengen Says:


    I haven’t used Firebird 2.5 with IBX. The last version I used with hcOPF was 2.1, but it could also be that the database path is not set correctly. The demos rely on a compiler directive to control the location of the database as shown in dmMain.pas of the Person demo:

    {$ifdef local_data}
    FirebirdDB.DatabaseName := Format(’%sPerson.FDB’,['C:\dev\Delphi\hcOPFData\']);
    FirebirdDB.DatabaseName := Format(’%sPerson.FDB’,[ExtractFilePath(Application.EXEName)]);

    IIRC, I did this because Firebird would not open a database on a mapped drive under Windows and I use a virtual machine with all my code and data on an external drive.

  11. Pavel Says:

    Hi, trying to use the hcOPF…

    i`ve managed to install the package (without devexpress)
    (disabling “codesite” checkbox doesnt work, i commented it out by hand)

    Now I`m trying to run the demos but i gave up so far…) cuz it`s 3am yet)

    it’s not very cool when i need to manually download lots of other stuff.. huff..
    (you may have included the jcl packages for example..)

    But, i`ve impressed more then tiOPF now, i like your style more)

    Thumbs up and best regards)

  12. Larry Hengen Says:


    You don’t need any third party packages if you only use the core hcOPF packages. JVCL/JCL is optional as is the DevEx components.

Leave a Reply