I'm using GPC 2.8.1 and I've got problems with the following manuever.
Down in my procedure "DestroyPQueue" I try to assign the address from the left pointer to the local pointer pseg. I get: "Assignment from incompatible pointer type". They are created from the same type so I don't understand why this doesn't work.
<---> module PriQueue interface;
export PriQueue = ( PQueue, ... ); .. type ElementType = Integer; SegPek = ^TreeSeg; TreeSeg = record data : ElementType; left : SegPek; right : SegPek; end; PQueue = record root : SegPek; numberOfElements : Integer; end; .. procedure DestroyPQueue(var pq : PQueue); .. end.
module PriQueue implementation;
type ElementType = Integer; SegPek = ^TreeSeg; TreeSeg = record data : ElementType; left : SegPek; right : SegPek; end; .. procedure DestroyPQueue; var pseg : SegPek; begin pseg := pq.root^.left; { HERE'S THE PROBLEM } .. end; .. end. <--->
____________________________________ Gratis epost med TJOHOOMAIL http://www.tjohoo.se
Fredrik Ismyren wrote:
Down in my procedure "DestroyPQueue" I try to assign the address from the left pointer to the local pointer pseg. I get: "Assignment from incompatible pointer type". They are created from the same type so I don't understand why this doesn't work.
No, they're two record types that look the same, but are distinct types in Pascal. Just export the types in the interface and don't declare them again in the implementation.
PS: When you post sample code, please send complete code. My compiler doesn't like `...', so it's hard to test things.
Frank