简体   繁体   English

组件Tperlregex致命错误L3169?

[英]Component Tperlregex fatal error L3169?

I have been using Tperlregex for some time. 我一直在使用Tperlregex。 but today when I try to compile an app built with Tperlregex, it prompts" fatal error: Internal error L3169". 但今天当我尝试编译使用Tperlregex构建的应用程序时,它会提示“致命错误:内部错误L3169”。

reg: Tperlregex;

begin
reg:=Tperlregex.create(nil); //If this line is removed, there is no error prompt.
...
...
end;

I am using Perlregex2009. 我正在使用Perlregex2009。

Please help. 请帮忙。

Edit: 编辑:

Andreas, Thank you so much. 安德烈亚斯,非常感谢你。

@Andreas Thank you so much for your immediate reply. @Andreas非常感谢你的回复。 I am using Delphi 7. Does your answer work in D7. 我正在使用Delphi 7.你的答案是否适用于D7。 And I find notes in pcre.pas (..Delphi 2009 and earlier have a compiler bug that may cause an internal error if install TPerlRegEx into a design time package, and you don't put TPerlRegEx into a runtime package at the same time. With Delphi 2009 and earlier you can use PCRE_STATICLINK if you don't use packages at all (which means you don't install it into the IDE..."). I have not installed it in IDE and I am putting perlregex unit in uses interface. and I set these lines in pcre.pas 我在pcre.pas中找到了注释(..Delphi 2009及更早版本有一个编译器错误,如果将TPerlRegEx安装到设计时包中,可能会导致内部错误,并且您不会同时将TPerlRegEx放入运行时包中。使用Delphi 2009及更早版本,如果您根本不使用软件包,则可以使用PCRE_STATICLINK(这意味着您不要将它安装到IDE中......“)。我还没有在IDE中安装它,我将perlregex单元放入使用interface。我在pcre.pas中设置这些行

 ...
{$DEFINE PCRE_LINKDLL}
{$IFDEF PCRE_STATICLINK}
{$UNDEF PCRE_LINKDLL}
{$ENDIF} 

Previously, it worked. 以前,它有效。 But today it does not. 但今天它没有。

Delphi 2009 seems to have a problem with the *.obj file exports. Delphi 2009似乎有* .obj文件导出问题。 The pcre_exec function must be called from the code. 必须从代码中调用pcre_exec函数。 If Delphi's "smart linker" removes it because it isn't called anywhere in the code (that isn't removed by the smart linker), the compiler fails. 如果Delphi的“智能链接器”将其删除,因为它不会在代码中的任何位置调用(智能链接器不会删除),编译器将失败。 This is a compiler bug, but you can work around it by making a small change to the PerlRegEx library. 这是一个编译器错误,但你可以通过对PerlRegEx库进行一些小改动来解决它。 You have to add a "UseFunction" local procedure (and a call to it) to the TPerlRegEx.Create constructor. 您必须向TPerlRegEx.Create构造函数添加“UseFunction”本地过程(以及对它的调用)。 So when you create a TPerlRegEx object, the smart linker won't remove the pcre_exec function. 因此,当您创建TPerlRegEx对象时,智能链接器将不会删除pcre_exec函数。

constructor TPerlRegEx.Create(AOwner: TComponent);

  procedure UseFunction(P: Pointer);
  begin
  end;

begin
  UseFunction(@pcre_exec); // if not used, D2009 will fail with internal compiler error
  UseFunction(@pcre_compile); // if not used, D7 will fail with internal compiler error
  inherited Create(AOwner);
end;

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

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