10-20-2008 03:43 AM
Hello
I get a access violation when i use InitWithOptions three times and i force that the first run, ant the other two fails.
I get an access violation in the third initwithoptions if i use options string so long.
optionsA : Api.Char_arr := interfaces.c.to_c("Simulate="&integer'image(standard.integer(device.Simul))&",RangeCheck="&integer'image(standard.integer(device.Range_check))&",QueryInstrStatus="&integer'image(standard.integer(device.Query_Instr))&",Cache="&integer'image(standard.integer(device.cache))&",DriverSetup="&fstr.trim(device.Driv_Setup,ada.strings.both));
optionsB : Api.Char_arr := interfaces.c.to_c("Simulate="&integer'image(standard.integer(device.Simul))&",RangeCheck="&integer'image(standard.integer(device.Range_check))&",QueryInstrStatus="&integer'image(standard.integer(device.Query_Instr))&",Cache="&integer'image(standard.integer(device.cache)));
begin
if device = null then
return;
end if;
if device.initCount = 0 then
if device.InitFail = true then
return;
end if;
hifu.card.lxi.commonfunctions.Add_LN(interfaces.c.to_c(fstr.trim(device.name,ada.strings.both)),
interfaces.c.to_c(fstr.trim(device.dir_ip,ada.strings.both)),
interfaces.c.to_c(fstr.trim(device.mod_id,ada.strings.both)),
interfaces.c.to_c(fstr.trim(device.model,ada.strings.both)),
error );
if (standard.integer(error)/=0) then
status := hStat.LXI.MODEL_NOT_SUPP;
hStat.Message.Put_Buffer_Message( status, "There is not installed an IVI driver for"&
fstr.trim(device.name,ada.strings.both));
Text_IO.Put_line( "Setup/ConfigureSWTCH: There is not installed an IVI driver that supports the instruments model "&
fstr.trim(device.model,ada.strings.both)&
". It is not possible to create an IviSession and logical name to control the Switch.");
device.InitFail:=true;
return;
end if;
if (fstr.trim(device.Driv_Setup,ada.strings.both)/="NONE") then
error:=api.Swtch.func.InitWithOptions(interfaces.c.to_c(fstr.trim(device.name,ada.strings.both)),1,0,
optionsA,
device.Session'access);
else
error:=api.Swtch.func.InitWithOptions(interfaces.c.to_c(fstr.trim(device.name,ada.strings.both)),1,0,
optionsB,
device.Session'access);
end if;
Why?????
Thanks