Hello:
I program a application with delphi7 and using visa32.dll. I have a problem.
enviroment:visa4.0, delphi7
init is done well.
buff_size:= 1024;
code-----------------------------
procedure TForm1.Button2Click(Sender: TObject);
var
istr: string;
retcount: integer;
vistate: integer;
begin
retcount := 0;
istr := ‘*IDN?’;
vistate := viwrite(vi, istr, length(istr), retcount);
if 0 <> vistate then begin
showmessage('viwrite wrong!');
exit;
end;
buffer := '';
setlength(buffer, buff_size);
vistate := viread(vi, buffer, buff_size, retcount);
if 0 <> vistate then begin
showmessage('viread wrong!');
exit;
end;
memo3.Lines.Add(buffer);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
button2.click;
end;
-------------------------------------------------------
problem:
1 in delphi->project->options->compiler, when optimization is not maked, Click Button2 from TForm1, then there is no error in viwrite。
2 in delphi->project->options->compiler, when optimization is maked, Click Button2 from TForm1, then there is error in viwrite。
3 in delphi->project->options->compiler, when optimization is not maked, Click Button3 from TFom1, then there is error in viwrite。
error picture link: