Delphi: Manual install

HexLicense is written in vanilla object pascal (common) so that it can be used with as many versions of Delphi as possible. It should also be compatible with Lazarus with only minor adjustments.

In practical terms, this means we have avoided modern features such as generics, custom attributes and anonymous procedures since these are only available in modern editions of the Delphi compiler.

These features would no doubt have made our lives easier, but we want HexLicense to be a low maintanance, robust and reliable ad-hoc solution. Having to re-make and adjust to every edition of Delphi or updates is not our idea of a solid solution.

Making a new package

While the unit code files are plain object pascal, the packages are not. Each version of Delphi demands packages built especially for that version. To make HexLicense install properly on your version of Delphi (unless the package we ship matches) you must do one of two things:

  • Create a new package
  • Adjust the default package

Why is this required? Well, Delphi packages have dependencies. If you are installing HexLicense for VCL then Delphi will automatically add the VCL run-time package when you build it. If you try to install that package on a different version of Delphi you will get an error, because the run-time library packages are never binary compatible.

All of this can perhaps sound very technical, but we will walk you through what you need to do step-by-step, and it will take 10 minutes at most to get everything working on your version of Delphi.

The include file

Before you do anything you need to edit the HexLicense include file:

This file can be found inside both the VCL and FMX (Firemonkey) folders. In our example here we will focus on the VCL edition, so the file should be found at:


Note: Please replace the $Hexlicense with the path to where HexLicense is located on your harddisk.

If you open the include-file with notepad you will see quite a few compiler defines covering the majority of Delphi compilers up to the latest.

If you are working with a very old Delphi version, or indeed – a new Delphi version that has not yet been added to the include-file, simply copy one of the existing sections and set  the new version number.

We sincerly doubt this is needed, but it’s important for us that you know about this file and what it does.

For older versions of Delphi one of the most important defines is


This controls if the code will use the old unit-names that pre-date namespaces, or the modern dot-notation names (like “system.sysutils” rather than plain old “sysutils”). If you experience problems with unit-names when compiling or installing then you know where to look and how to fix it.

Creating a new package

Depending on the age of your Delphi edition, adjusting the package might not be possible. Delphi packages (even the projects) are not backwards compatible and unless you are an expert and know how to manually edit the package files, creating a new package is the quickest and safest way.

So with the include-file edited or verified, fire up Delphi and let’s build a package!

Packages are also projects and created the same way

With Delphi started click the File menu and select new, then “new package”. Sadly we did not have any older Delphi versions at hand while writing this, but the process has been the same for almost two decades – so you should have no problems creating one.

It’s easy to forget that a package is also a project in Delphi. In this case a project that should contain the units holding the components, description and various other pieces of information. But we will keep it simple because you probably just want to get the components onto the tool palette.

The package project in all it’s glory

Once you have clicked “new package” the project is created and something like the picture above should appear in the project manager. Notice that Delphi adds that dependency we talked about earlier (the “rtl.dcp” under Requires).

Before we add the HexLicense unit files, let’s save the project and give it a more natural name like “hexlicense”. Remember to save it somewhere relative to the unit files. And also to add the path to the folder to the Delphi search path-list (more about that later) so Delphi can find the files.

Next, right-click the “contains” icon in the project manager and click the “Add …” option.

Just add the units to the package

When you click the “Add …” option a file-dialog opens up and you select the units from the VCL folder. As of writing these are:

  • HexBuffers.pas
  • HexMgrLicense.pas
  • HexMgrLicenseForm.pas
  • HexMgrReg.pas
  • (optional)

Your project manager should now look something like this:

Straight forward package

Indy and extras

Before we continue we need to talk about the bonus unit “hexbuffers.pas”. This is a special unit that gives you some very powerful binary buffer classes. These buffers can also load data directly from the internet (which is very handy) and thus depends on the Indy component package.

If you have no need for this or perhaps use another networking package, take the time to double-click on the hexbuffers.pas unit and adjust the compiler defines in that unit.

To disable the internet feature (and dependency on Indy), simply disable the HEX_SUPPORT_INTERNET compiler define and save the unit before you continue. You disable the define by adding a “.” (punctuation) like shown below.


If you opt to keep the internet feature the following (or similar) dialog will appear when you build the package. Just click OK to add the dependencies to the package.


Ok let’s get our package built! To build simply right-click the “Hexlicense.bpl” (assuming you named the package as such) and click the “build” option.

The compiler will build the package and you are now 80% done!

Installing the package

With the package built you are now ready to install it. Once again you right-click the HexLicense.bpl item in the project manager view, and then click the “install” menu.


After a second or two you will be greeted with the following dialog, listing the components that have now been made available on your tool-palette:


Save and close the package project, you have now installed Hexlicense manually from source.

Please note that the HexBuffers unit is a bonus unit. If you work with large binary files it will be a life-saver since it has all the missing functions from TStream. Methods like Insert and Remove which physically injects (and push data forward) or remove (and re-size the stream) using code that is optimized for speed.

The code in HexBuffers have been used for years in database engines, networking, ISO cd-rom image builders and other production level software. We hope you enjoy the bonus code and that it helps you make your already great products even greater.


Quartex Components