简体   繁体   English

当dcu存在时,Delphi是否在编译时需要dfm?

[英]Does Delphi require dfm at compile time when dcu is present?

I always assumed that the dcu file is all that is needed at compile time. 我一直认为dcu文件是编译时所需要的。 At least, the source files (pas and dfm) should not be required. 至少,不需要源文件(pas和dfm)。

I have the following situation: 我有以下情况:

  • A Delphi application with two units that each contain a form: Delphi应用程序,包含两个单元,每个单元包含一个表单:
    • UMain contains form TMain UMain包含TMain形式
    • USubForm contains form TSubForm USubForm包含表格TSubForm
  • USubForm is in the uses clause of UMain USubForm属于UMain的使用条款
  • After I compile this program, I removed USubForm.pas and USubForm.dfm and replaced them by the compiled USubForm.dcu. 编译完程序后,我删除了USubForm.pas和USubForm.dfm,并用编译好的USubForm.dcu替换它们。
  • Compilation now results in an error: DCC : error : E1026 File not found: 'USubForm.dfm' 编译现在导致错误: DCC : error : E1026 File not found: 'USubForm.dfm'
  • Note that if I only remove USubForm.pas (but leave USubForm.dfm file in place next to USubForm.dcu), the compilation works. 请注意,如果我只删除USubForm.pas(但在USubForm.dcu旁边保留USubForm.dfm文件),编译工作。

I don't understand. 我不明白。 I thought the dcu file would be all I need (ie it's the compiled version of the pas + dfm file). 我认为dcu文件将是我所需要的(即它是pas + dfm文件的编译版本)。

I'm using Delphi XE2 (we should be upgrading soon, but I don't think this is relevant for my question). 我正在使用Delphi XE2(我们应该尽快升级,但我不认为这与我的问题相关)。

PS Some context: I'm trying to setup a continuous integration system for our in-house Delphi libraries and applications. PS一些上下文:我正在尝试为我们的内部Delphi库和应用程序设置一个持续集成系统。 I'd like to be able to compile applications without needing the source files of the libraries. 我希望能够在不需要库的源文件的情况下编译应用程序。

Yes, you need the DFM file when you link your project. 是的,链接项目时需要DFM文件。 It's treated like a resource file. 它被视为资源文件。 As I recall, it's not required when compiling. 我记得,它不是必需的编译时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM