[Lazarus] Different behavior of method and class variables
Mattias Gaertner
nc-gaertnma at netcologne.de
Sun Nov 29 16:32:11 CET 2015
On Sun, 29 Nov 2015 11:07:11 -0300
Leonardo M. Ramé <l.rame at griensu.com> wrote:
> 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.
No, lHRobots is not defined.
> 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?.
Please provide a complete example.
Mattias
More information about the Lazarus
mailing list