我在bpl中封装了一个窗体,定义了几个全局变量,在主程序中调用,但以调用就出现错误,错误提示如下:
Project test.exe raised exception class EAccessViolation with message'Access violatin at address 400068AC in module 'rtl70.bpl',Read of address 0000002F8'.Process stopped,Use Step orRun to continue.我在工程属性已经选择了‘build with runtime package',使用的包:vcl;rtl;Pub,其中pub是我自己建的包
我比较困惑的是为什么冲突是在rtl70呢?
Project test.exe raised exception class EAccessViolation with message'Access violatin at address 400068AC in module 'rtl70.bpl',Read of address 0000002F8'.Process stopped,Use Step orRun to continue.我在工程属性已经选择了‘build with runtime package',使用的包:vcl;rtl;Pub,其中pub是我自己建的包
我比较困惑的是为什么冲突是在rtl70呢?
unit Pub_frm;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;type
TfrmPub = class(TForm)
private
{ Private declarations }
public
{ Public declarations }
ygbm,xm,jsbm,jsmc:string;
end;var
frmPub: TfrmPub;implementation{$R *.dfm}end.主程序调用的代码
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation
uses Pub_frm;
{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
begin
frmPub.ygbm := '';
end;end.
调用的地方:
procedure TForm1.Button1Click(Sender: TObject);
begin
frmPub := TfrmPub.Create(nil);
frmPub.ygbm := '';
end;
问你几个问题:
1. 哪些全局变量发生了冲突?
2. 在哪一步出现了 冲突?
3. bpl 中的变量你是如何调用的?