[Lazarus] Pointer woes when trying to port a Delphi program

brian brian at meadows.pair.com
Fri Aug 24 21:22:33 CEST 2012


Hi all,

I'm trying to port a Delphi program to Lazarus, although I'm redoing 
the interface from scratch.

Without getting into to much detail about what the program does, it 
needs an array of 72 buttons on the main screen, these buttons have 
their captions changed and are variously enabled and disabled as the 
program executes.

Because of the underlying logic, it's easiest to manipulate these 
buttons as an array of pointers to the buttons (in fact two arrays, 
but that's not really relevant).

So, I have

Type
  TBtnPtr = ^TButton;
  TBtnArray = Array [1..36] of TBtnPtr;

Var
  Buttons1, Buttons2 : TBtnArray;


Then in a procedure called from the Form's OnCreate, I set the arrays 
up :-

Buttons[1]^ := FirstButton;
Buttons[2]^ := SecondButton;

etc, etc.

Everything compiles OK, but at runtime, the moment the program reaches 
that first assignment statement running interactively under GDB, I get 
an error "Exception class External : SIGSEGV"

This is using SVN 38353M (downloaded and built this morning) with FPC 
2.6.0 on an AMD Phenom X4 box running Debian SID 64-bit, and 
generating a 64 bit executable.

I'm lost. This same code worked under Delphi 7. Can anyone give me a 
hint as to what I'm doing wrong? I wanted to create the buttons as 
design time so that I can set the initial layout, but if I need to 
create them dynamically I can do that.


Thanks

Brian




More information about the Lazarus mailing list