[Lazarus] Trying to troubleshoot error

Bart bartjunk64 at gmail.com
Thu Dec 15 13:06:43 CET 2011


On 12/5/11, Chris Kelling <kellingc at cox.net> wrote:
> I'm trying to read from a file and populate a stringgrid, and keep
> getting 'Project spares.exe raised an exception class 'External error:
> SIGSEGV' when trying to convert an integer to string.

> var
>    {stockItem type is a record with the following structure:
>      recordID    : longint;
>      ClassNumber : integer;
>      PartNumber  : string;
>      Make        : String;
>      TypeofEqip  : string;
>      Model       : string;
>      Description : string;
>      quantity    : integer;
>      location    : string;
>      price       : real;    }


Depending on the current compiler directive {$H+} (default for any
lazarus program) type string will be ansistring.
If you write a record with a variable of type ansistring to file, it
will write the pointer to that string.
If you read that file, this poiter probably will point to something
you have no access to --> SIGSEV

Change all string explictely to ShortString in the definition of your record.

Bart




More information about the Lazarus mailing list