The general error it raises is: "Access Violation"
From: fpc-pascal-boun...@lists.freepascal.org [mailto:fpc-pascal-boun...@lists.freepascal.org] On Behalf Of ik Sent: Wednesday, February 02, 2011 10:31 AM To: FPC-Pascal users discussions Cc: mac-pas...@listman.sonic.net Subject: Re: [fpc-pascal] dynamic array and new/dispose On Wed, Feb 2, 2011 at 10:20, Amit Bueno <amitbu...@gmail.com> wrote: I am writing an application on iMac, and having problem dynamically creating objects and reading them into an array: // I got the following object: PChunk = ^Chunk; Chunk = Object SubChunks: array of PChunk; Data: Pointer; . Function NewSubchunk: integer; Procedure Read(var Fl: TStream); Constructor Create; Destructor Destroy; end; // creating and reading more data SubChunks[NewSubChunk]^.read(Fl); // NewSubChunk function Function Chunk.NewSubchunk: integer; begin setlength(SubChunks, High(SubChunks)+2); New(subchunks[High(SubChunks)], create); SubChunks[High(SubChunks)]^.Data := Self.Data; Result := High(SubChunks); end; // --------- The procedure fails when running the: SubChunks[NewSubChunk]^.read(Fl); All the procedure works fine on Delphi, but on fpc under iMac it fails. Why? What is the error message you are having ? Regards, Amit _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal Ido LINESIP - Opening the source for communication http://www.linesip.com <http://www.linesip.com/> http://www.linesip.co.il <http://www.linesip.co.il/>
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal