delphi配置文件_Delphi构建配置中的调试与发布

本文详细介绍了Delphi的调试与发布构建配置,包括它们的区别和用途。调试配置用于开发和调试,禁用优化,启用调试信息。发布配置则启用优化,不生成调试信息,以减小可执行文件的大小,适用于最终用户。此外,还讨论了构建配置的扩展和自定义可能性。
摘要由CSDN通过智能技术生成

delphi配置文件

构建配置-基础:调试,发行 ( Build Configurations - Base: Debug, Release )

Delphi Project Manager

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.

Delphi (RAD Studio)IDE中的“项目管理器”窗口显示并组织当前项目组及其包含的任何项目的内容。 它将列出项目中的所有单元以及包括的所有表单和资源文件。

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.

一些最近的版本(正确的是:从Delphi 2007开始)Delphi版本具有两个(三个)默认的生成配置:DEBUG和RELEASE。

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

条件编译101文章的确提到了构建配置,但没有详细说明差异。

调试与发布 ( 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.

默认情况下,在启动新项目时,会Delphi创建三个(即使在项目管理器中您只会看到两个)构建配置。 这些是基础,调试和发布。

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 another 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.

调试配置通过禁用优化和启用调试以及设置特定的语法选项来扩展Base。

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.

Release配置将Base扩展为不产生符号调试信息,也不为TRACE和ASSERT调用生成代码,这意味着减小了可执行文件的大小。

You can add your own build configurations, and you can delete both the default Debug and Release configurations, but you cannot delete the Base one.

您可以添加自己的构建配置,也可以删除默认的Debug和Release配置,但是不能删除Base。

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

构建配置保存在项目文件(.dproj)中。 DPROJ是一个XML文件,下面是带有构建配置的部分:

00400000
.\$(Config)\$(Platform)
WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;$(DCC_UnitAlias)
.\$(Config)\$(Platform)
DEBUG;$(DCC_Define)
false
true
false
RELEASE;$(DCC_Define)
0
false

Of course, you will not alter the DPROJ file manually, it is maintained by Delphi.

当然,您不会手动更改DPROJ文件,它是由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.

在开发应用程序时,您可以直接从IDE对其进行编译,构建和运行。 编译,构建和运行将生成可执行文件。

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.

编译将语法检查您的代码并编译应用程序-仅考虑自上次构建以来已更改的那些文件。 编译产生DCU文件。

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.

运行将编译代码并运行应用程序。 您可以在调试(F9)或不调试(Ctrl + Shift + F9)的情况下运行。 如果在没有调试的情况下运行,则不会调用IDE内置的调试器-您的调试断点将“不起作用”。

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

现在您知道了如何保存构建配置以及在何处保存构建配置,现在让我们看看“调试”和“发布”构建之间的区别。

构建配置:DEBUG-用于调试和开发 ( Build Configuration: DEBUG - for Debugging and Development )

Debug Build Configuration in Delphi

The default build configuration Debug, you can locate in the Project Manager for your Delphi project, is created by Delphi when you created a new application/project.

您可以在Delphi项目的项目管理器中找到默认的构建配置Debug,它是在创建新的应用程序/项目时由Delphi 创建的

Debug configuration disables optimization and enables debugging.

调试配置禁用优化并启用调试。

To edit the build configuration: right-click the configuration name, select "Edit" from the context menu and you will find yourself looking at the Project Options dialog box.

要编辑构建配置:右键单击配置名称,从上下文菜单中选择“编辑”,您会发现自己在“项目选项”对话框中。

调试选项 ( Debug Options )

Since debug extends the Base configuration build, those settings that have a different value will be displayed in bold.

由于调试扩展了基本配置构建,因此具有不同值的那些设置将以粗体显示。

For Debug (and therefore debugging) the specific options are:

对于调试(以及因此调试),特定选项为:

  • Delphi Compiler - Compiling - Code Generation - Optimization OFF - the compiler will NOT perform a number of code optimizations, such as placing variables in CPU registers, eliminating common subexpressions, and generating induction variables.

    Delphi编译器-编译-代码生成- 优化关闭 -编译器将不会执行许多代码优化,例如将变量放置在CPU寄存器中,消除公共子表达式并生成归纳变量。

  • Delphi Compiler - Compiling - Code Generation - Stack Frames ON - stack frames are always generated for procedures and functions, even when they're not needed.

    Delphi编译器-编译-代码生成- 堆栈帧打开 -始终为过程和功能生成堆栈帧,即使不需要它们也是如此。

  • Delphi Compiler - Compiling - Debugging - Debug Information ON - when a program or unit is compiled with this option enabled, the integrated debugger lets you single-step and set breakpoints. Debug information being "on" does not affect the size or speed of the executable program - debug information is compiled into the DCUs and does not get linked into the executable.

    Delphi编译器-编译-调试- 调试信息打开 -在启用此选项的情况下编译程序或单元时, 集成调试器可让您单步执行并设置断点 。 调试信息为“ on”不会影响可执行程序的大小或速度-调试信息被编译到DCU中,并且不会链接到可执行文件中。

  • Delphi Compiler - Compiling - Debugging - Local symbols ON - When a program or unit is compiled with this option enabled, the integrated debugger lets you examine and modify the module's local variables. Local symbols being "on" does not affect the size or speed of the executable program.

    Delphi编译器-编译-调试- 本地符号打开 -在启用此选项的情况下编译程序或单元时, 集成调试器可让您检查和修改模块的本地变量 。 本地符号为“开”不会影响可执行程序的大小或速度。

NOTE: by default, the "use debug .dcus" option is OFF. Setting this option on enables you to debug Delphi VCL source code (set a breakpoint in the VCL)

注意:默认情况下, “使用调试.dcus”选项为OFF。 将此选项设置为on可以调试Delphi VCL源代码(在VCL中设置断点)

Let's now see what "Release" is about...

现在,让我们看看“发行”是关于...的。

构建配置:发布-用于公共发行 ( Build Configuration: RELEASE - for Public Distribution )

Delphi Release Build Configuration

The default build configuration Release, you can locate in the Project Manager for your Delphi project, is created by Delphi when you created a new application/project.

您可以在Delphi项目的项目管理器中找到默认的构建配置版本,该版本是在创建新的应用程序/项目时由Delphi创建的。

Release configuration enables optimization and disables debugging, the code is not generated for TRACE and ASSERT calls, meaning the size of your executable is reduced.

版本配置启用优化并禁用调试,不会为TRACE和ASSERT调用生成代码,这意味着可执行文件的大小减小了。

To edit the build configuration: right-click the configuration name, select "Edit" from the context menu and you will find yourself looking at the Project Options dialog box.

要编辑构建配置:右键单击配置名称,从上下文菜单中选择“编辑”,您会发现自己在“项目选项”对话框中。

发行选项 ( Release Options )

Since release extends the Base configuration build, those settings that have a different value will be displayed in bold.

由于发行版扩展了基本配置构建,因此具有不同值的那些设置将以粗体显示。

For Release (the version to be used by the users of your application - not for debugging) the specific options are:

对于Release(应用程序用户要使用的版本-而非调试版本),特定选项为:

  • Delphi Compiler - Compiling - Code Generation - Optimization ON - the compiler will perform a number of code optimizations, such as placing variables in CPU registers, eliminating common subexpressions, and generating induction variables.

    Delphi编译器 -编译-代码生成- 优化打开 -编译器将执行许多代码优化,例如将变量放置在CPU寄存器中,消除常见的子表达式,并生成归纳变量。

  • Delphi Compiler - Compiling - Code Generation - Stack Frames OFF - stack frames are NOT generated for procedures and functions.

    Delphi编译器-编译-代码生成- 堆栈帧关闭 -不为过程和功能生成堆栈帧。

  • Delphi Compiler - Compiling - Debugging - Debug Information OFF - when a program or unit is compiled with this option disabled, the integrated debugger does NOT let you single-step and set breakpoints.

    Delphi编译器-编译-调试- 调试信息OFF-当在禁用该选项的情况下编译程序或单元时, 集成调试器不允许您单步执行并设置断点

  • Delphi Compiler - Compiling - Debugging - Local symbols OFF - When a program or unit is compiled with this option disabled, the integrated debugger does NOT let you examine and modify the module's local variables.

    Delphi编译器-编译-调试- 本地符号OFF-在禁用该选项的情况下编译程序或单元时, 集成调试器不允许您检查和修改模块的本地变量

Those are the default values set by Delphi for a new project. You can alter any of the Project options to make your own version of debugging or release build configurations.

这些是Delphi为新项目设置的默认值。 您可以更改任何“项目”选项以进行自己的调试版本或发布构建配置。

翻译自: https://www.thoughtco.com/debug-vs-release-in-delphi-build-configurations-1058251

delphi配置文件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值