1. Computing

Debug vs. Release In Delphi Build Configurations


1 of 3

Build Configurations - Base: Debug, Release
Delphi Project Manager

Delphi Project Manager

Zarko Gajic
The Project Manager window in your Delphi (RAD Studio) IDE displays and organizes the contents of your current project group and any projects it contains. It will list all the units that are part of your project as well as all the forms and resource files included.

The Build Configurations section will list various build configurations you have for your project.

Some more recent (to be correct: starting from Delphi 2007) Delphi versions have two (three) default build configurations: DEBUG and RELEASE.

The Conditional Compilation 101 article does mention build configurations but does not explain the difference in details.

Debug vs. Release

Since you can activate each of the build configurations you see in the Project Manager, and build your project producing a different executable file, the question is what is the difference between Debug and Release?

The naming itself: "debug" and "release" should point you in the right direction.

  • Debug configuration should be active and used while we are developing and debugging and changing your application.
  • Release configuration should be activated when we are building your application so that the produced executable file to be sent to the users.
Yet, the question remains: what's the difference? What can you do while "debug" is active and what is included in the final executable file vs. how does the executable look when "release" is applied?

Build Configurations

By default there are three (even though in the Project Manager you only see two) build configurations created by Delphi when you start a new project. Those are: Base, Debug and Release.

The Base configuration acts as a base set of option values that is used in all the configurations you subsequently create.

The option values mentioned, are the compiling and linking and other set of options you can alter for your project using the Project Options dialog (main menu: Project - Options).

The Debug configuration extends Base by disabling optimization and enabling debugging, as well as setting specific syntax options.

The Release configuration extends Base to not produce symbolic debugging information, the code is not generated for TRACE and ASSERT calls, meaning the size of your executable is reduced.

You can add your own build configurations (like it was done in the Two Applications In One Delphi Program article), you can delete both the default Debug and Release configurations, but you cannot delete the Base one.

Build configurations are saved in the project file (.dproj). The DPROJ is an XML file, here's how the section with build configurations:

<PropertyGroup Condition="'$(Base)'!=''">
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<PropertyGroup Condition="'$(Cfg_2)'!=''">
Of course, you will not alter the DPROJ file manually, it is maintained by Delphi.

You *can* rename build configurations, you *can* alter the settings for each build configuration, you *can* make it so that "release" is for debugging and "debug" is optimized for your clients. Therefore you need t know what you are doing :)

Compiling, Building, Running

As you are working on your application, developing it, you can compile, build, and run the application directly from the IDE. Compiling, building and running will produce the executable file.

Compiling will syntax check your code and will compile the application - taking into account only those files that have changed since the last Build. Compiling produces DCU files.

Building is an extension to compiling where all the units (even those not altered) are compiled. When you change project options you should build!

Running compiles the code and runs the application. You can run with debugging (F9) or without debugging (Ctrl+Shift+F9). If run without debugging, the debugger built into the IDE will not be invoked - your debugging breakpoints will "not" work.

Now that you know how and where the build configurations are saved, let's see the difference between the Debug and Release builds.

©2014 About.com. All rights reserved.