strange behavior under debug lazarus / 12-Debugger ---------------------------------------------------------------------- angman · 2007-03-16 14:06 I have a console application that call some functoin on a c dll. The application works good out of the ide, but if I execute it in the lazarus ide, it work or depending on a value setted in a record field. The environment is Debian sarge, lazarus 0.9.18 this is the code: begin      errorParams.ErrCode := 0;      errorParams.errstring := '';          vdscb := 0;      sample := 0;      voltage := 0.0;        //================================================================= ========    // I. DRIVER INITIALIZATION    //    //    Initializes the DSCUD library.    //    //================================================================= ========         result := dscInit(DSC_VERSION);         writeln('Init Status = ' + IntToStr(result));    if result <> DE_NONE then     begin         dscGetLastError(errorParams);         writeln(format('dscInit error: %s %s', [dscGetErrorString(errorParams.ErrCode), intToStr(errorParams.ErrCode)] ));       //  exit;    end;         //Board initialization    writeln('PROM BOARD INITIALIZATION:');         FillChar(vdsccb, sizeOf(vdsccb), $0);    vdsccb.base_address := $280;    vdsccb.int_level := 5; //with values 0-2 works with values > 3 when I call dscInitBoard I get a sigSegv         DsccbSize := SizeOf(vdsccb);         DsccbSize := SizeOf(MyDsccb);    if dscInitBoard(DSC_PROM, vdsccb, vdscb) <> DE_NONE then //   if dscInitBoard(DSC_PROM, MyDsccb, vdscb) <> DE_NONE then         begin         dscGetLastError(errorParams);         writeln(format('dscInitBoard error: %s %s', [dscGetErrorString(errorParams.ErrCode), errorParams.errstring]));              exit;         end; Some idea on this? Thanks,  angman :?: ---------------------------------------------------------------------- Marc · 2007-03-19 12:53 what doesn't work ? what record do you have the values to ? ---------------------------------------------------------------------- angman · 2007-03-21 09:58 the record definition is:      DSCCB = record           boardtype : BYTE;           boardnum : DSCB;           base_address : WORD;           int_level : BYTE;           RMM_external_trigger : BOOL;           RMM_external_trigger_c3 : BOOL;           EMM_IOAddr : array[0..7] of WORD;           EMM_Interrupt : array[0..7] of WORD;           clkfrq0 : BYTE;           clkfrq1 : BYTE;           clksel1 : BYTE;           address_space : WORD;           clock_freq : LONG;           dma_level : BYTE;           int_level1 : BYTE;           int_level2 : BYTE;           int_level3 : BYTE;           fpga : WORD;           SMM_AD_resolution : BYTE;           RMM_mode_16bit : BOOL;           RMM_DAC_0_3_external_enable : BOOL;           RMM_DAC_4_7_external_enable : BOOL;        end; when I set the vdscb.Int_level if set it to values less than 3 works but with values > 2 calling dscInitBoard I get a sigSegv . This happen only running in the ide, the console appllcation  launched outside the ide works good. Thanks, angman ---------------------------------------------------------------------- Marc · 2007-03-21 13:39 intlevel is some trigger level the card starts to do something ? Maybe the driver has some problems when it is debugger, or another posibility is that the Segv is handled in the dll, but when debugging it gets triggered there first. What happens if you continue ? ---------------------------------------------------------------------- angman · 2007-03-23 14:54 well, going on I get a dialog that show the address and the procedure name (i think this id in dll) and then going on an other dialog thet says run error(216). thanks, angman  :roll: ---------------------------------------------------------------------- Marc · 2007-03-23 16:27 Iv'e no idea what can cause this, Especially since i've no clue what "vdsccb.int_level" has for effects on your library ---------------------------------------------------------------------- angman · 2007-03-26 10:48 Yes, but doo you have some thinking about the fact that the sigsegv happen only using the lazarus ide while running the program outside, all seems work good? Thanks, angman ---------------------------------------------------------------------- Marc · 2007-03-27 11:58 A few things: different environment, different loading location, different exception handling All things which shouldn't affect a normal program, but I don't know how this dll is coded (and I've seen bad ones) ---------------------------------------------------------------------- angman · 2007-03-27 14:53 I am not compleatiy shure but I think that is a c dll. However, thanks very much for time that you spent to give help. angman