I have been using Tperlregex for some time. but today when I try to compile an app built with Tperlregex, it prompts" fatal error: Internal error L3169".
reg: Tperlregex;
begin
reg:=Tperlregex.create(nil); //If this line is removed, there is no error prompt.
...
...
end;
I am using Perlregex2009.
Please help.
Edit:
Andreas, Thank you so much.
@Andreas Thank you so much for your immediate reply. I am using Delphi 7. Does your answer work in 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
...
{$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. The pcre_exec
function must be called from the code. 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. This is a compiler bug, but you can work around it by making a small change to the PerlRegEx library. You have to add a "UseFunction" local procedure (and a call to it) to the TPerlRegEx.Create
constructor. So when you create a TPerlRegEx object, the smart linker won't remove the pcre_exec
function.
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;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With