[Lazarus] Newbie, porting class to FPC but get procedure assignment error

Bo Berglund bo.berglund at gmail.com
Mon Jun 22 19:02:33 CEST 2015


On Mon, 22 Jun 2015 13:29:07 -0300, luiz americo pereira camara
<luizmed at oi.com.br> wrote:

>In my experince sigsegv occurs mostly when a field or variable is accessed
>before initialization.
>
>Try to set a breakpoint in dongle.initkey call. And evaluate the dongle
>field (open debugger evaluate window)
>
>Look for dongle or one of the tsentinel fields being nil
>

I have already a breakpoint in the on-click event handler for the
button. The code is:

procedure TfrmMain.btnFindKeyClick(Sender: TObject);
var
  SerialNo: word;
begin
  //Code to check for the dongle and if found display its contents
  Dongle.InitKey;  <-- Breakpoint here
  Dongle.AppNumber := 1;
  if Dongle.CheckKey then
  begin
    SerialNo := Dongle.SerialNo;
    stxSerialNo.Caption := IntToStr(SerialNo);
  end;
end;

When Lazarus stops and I hover over the Dongle variable (which was
created in the form's OnCreate event) I see all fields of the Dongle
object and they seem to be normal, except for the FSentinelPacket.

This is supposed to be an array of char [1..1028] but it says 
FSENTINELPACKET=#0#0#0#0Truncated 1027->1000####

Does this imply that the size of the packet has been initialized
erroneously?
It is defined thus: ARRAY [1..1028] OF CHAR;
Can the indexing be a problem? The packet is defined with a starting
index of 1 rather than 0...


-- 
Bo Berglund
Developer in Sweden





More information about the Lazarus mailing list