From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3dabbcc9e41d65e8 X-Google-Attributes: gid103376,public From: Laurent Guerby Subject: Re: Program_Error because of Finalization. Date: 2000/09/17 Message-ID: <86g0mz1cao.fsf@acm.org>#1/1 X-Deja-AN: 670799495 References: <39C3B125.209C0440@acm.org> X-Trace: front3m.grolier.fr 969190459 26513 195.36.164.60 (17 Sep 2000 11:34:19 GMT) Organization: Club-Internet (France) NNTP-Posting-Date: 17 Sep 2000 11:34:19 GMT Newsgroups: comp.lang.ada Date: 2000-09-17T11:34:19+00:00 List-Id: Marin David Condic writes: > O.K., This one is a bit long. I'm having trouble using the Stream_IO > facilities to input and output a class-wide type that is referenced with > an access object. Basically, it works just fine so long as a) the object > is just a static declaration with no pointer or b) I do not derive the > class from Ada.Finalization. The smallest example I could come up with > is here: [...] Ada.Finalization.Controlled is likely to have some pointers in it, and so using the predefined read/input attribute to build such an object from a binary image is likely to cause havoc. The solution is to redefine the stream attributes for your object to bypass the predefined ones. I remember myself mentionning this issue (stream attribute on Controlled) to the standard list while I was working on the distributed annex, but I don't remember if some AI was issued or not. Also, you might want to change procedure Load (File: in out ASIO.File_Type ; Obj : in out Some_Type'Class) ; to a function returning a class-wide type, since with the procedure version, the tag will be determined by the caller actual and you won't be able to change it inside Load. declare X : Some_Type'Class := Load (F); begin --... end; -- Laurent Guerby