[fpc-pascal]pointers under linux
adeli@adeli.fr
Ldrevon at adeli.fr
Sun Mar 17 23:54:31 CET 2002
Date sent: Fri, 15 Mar 2002 09:35:50 +0100
From: Shifted Soul <snsii at yahoo.fr>
To: fpc-pascal <fpc-pascal at deadlock.et.tudelft.nl>
Subject: [fpc-pascal]pointers under linux
Send reply to: fpc-pascal at deadlock.et.tudelft.nl
DON't use $H+
> Hello
> I get for you some troubles.
> Lately I developped a unit which function perfectly under go32 and not
> under linux. But I didn't use any specific instruction for a given
> platform. So I debugged it under linux, and I found where the problem.
> But why it works under go32 and not under linux. I give you a sample
> program which don't work under linux :
>
> {$MODE OBJFPC}
> {$H+}
> type
> t = ^trec;
> trec = record
> s : string;
> n : t;
> end;
>
> var
> t1 : t;
>
> begin
> new(t1);
> t1^.s := 'hello';
> t1^.n := Nil;
> new(t1^.n);
> t1^.n^.s := 'Hello2';
> end.
>
> It will give me RT Error 216 (in the unit, where I use classes, it is
> Access Violation exception). gdb told me that it stops at the
> instruction _SYSLINUX$$_INITIALIZE$POINTER$POINTER The problem araises
> only in these conditions : + $H+ enabled + chained list + initialize
> the next item by nil (t1^.n := Nil;) + create it by new (new(t1^.n);)
> it stops then. I have the solution for the problem : create the next
> item seperately and link it :
>
> new(p);
> t1^.n := p;
>
> but I want to know why we can't use the first way ?
> Sorry for the problem.
>
> NB : I use fpc 1.0.4 under linux RPM version, I will use the next
> version when i complete downloading it (I have a modem with 4kB/s)
>
>
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Lionel Drevon ldrevon at adeli.fr
Adeli http://www.adeli.fr
618 Av. Gal de Gaulle Tel 04 78 66 11 85
69760 Limonest Fax 04 78 66 04 33
More information about the fpc-pascal
mailing list