[Lazarus] Different behavior of method and class variables
Leonardo M. Ramé
l.rame at griensu.com
Sun Nov 29 15:07:11 CET 2015
I'm creating a class out of a C header converted to pascal using h2pas.
I created this type:
pRobotArray = ^TArray0toMAX_ROBOT_DRIVES1OfHANDLE;
If I use it inside a method, like this:
procedure TMyClass.myMethod;
var
lRobots: pRobotArray;
begin
getRobots(lHRobots);
lRobots := @lHRobots; // this works ok.
end;
If I add an FRobots var to my class:
TRobotClass = class
private
FRobots: pRobotArray;
public
procedure myMethod;
end;
procedure TMyClass.myMethod;
begin
getRobots(lHRobots);
FRobots := @lHRobots; // I get an external SIGSEGV.
end;
Why the difference?.
Regards,
--
Leonardo M. Ramé
http://leonardorame.blogspot.com
More information about the Lazarus
mailing list