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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f2eea90d04e1d9,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-10 05:58:31 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: paul.nardini@itt.com (Paul Nardini) Newsgroups: comp.lang.ada Subject: Allocating memory for class-wide types with Aonix Raven PPC cross-compiler Date: 10 Mar 2004 05:58:30 -0800 Organization: http://groups.google.com Message-ID: <64897075.0403100558.69900baa@posting.google.com> NNTP-Posting-Host: 63.109.236.92 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1078927110 2934 127.0.0.1 (10 Mar 2004 13:58:30 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 10 Mar 2004 13:58:30 +0000 (UTC) Xref: archiver1.google.com comp.lang.ada:6210 Date: 2004-03-10T05:58:30-08:00 List-Id: We use the Raven compiler in my office, and I have some code which attempts to instantiate a doubly linked list package with a class-wide type. The list package allocates / deallocates space for the items placed on the list in a custom memory pool though an access type passed in as a generic formal parameter with the list's data type. The access type I am passing at instantiation is the access type corresponding to the class-wide type I am passing the generic. A snippet of what I am trying to do is below: type FOO_TYPE is tagged record FIELD1 : INTEGER; end record; type BAR_TYPE is new FOO_TYPE with record FIELD2 : INTEGER; end record; type FOO_ACCESS_TYPE is access FOO_TYPE'Class; -- MY_STORAGE_POOL is a finite pool used only by the list class where allocation -- and deallocation are allowed. for FOO_ACCESS_TYPE'Storage_Pool use MY_STORAGE_POOL; generic DATA_TYPE(<>) is tagged private; DATA_ACCESS_TYPE is access DATA_TYPE; SIZE : POSITIVE := 256 package List is ... procedure Free is new Ada.Unchecked_Deallocation(DATA_TYPE, DATA_ACCESS_TYPE); procedure Add_To_Tail(ITEM : in DATA_TYPE) is begin ... -- DATA_PTR is of type DATA_ACCESS_TYPE NEW_TAIL_PTR.DATA_PTR := new DATA_TYPE'(ITEM); end Add_To_Tail; procedure Delete(ITEM : in ITERATOR) is begin ... -- DATA_PTR is of type DATA_ACCESS_TYPE Free(ITEM.DATA_PTR); end Delete; ... end List; package My_List is new List(FOO_TYPE'Class, FOO_ACCESS_TYPE. 256); The code is written for a messaging framework where the type of the message coming in is only known to be of the messaging class; the message is taken off the list and dispatched to a handler according to its 'Tag attribute. The code compiles fine under the Raven PowerPC cross-compiler, but when I go to link it I get errors stating that the following symbols are undefined: Rts_tagged_finalize_and_deallocate_from_pool Rts_classwide_allocate_from_pool_and_assign The undefined procedures are called whenever I do allocation / deallocation of an element on the list. I have this same list package instantiated for non-classwide types, and those link fine. It is only when I try to use the instantiation for the class-wide type do I have a problem. Has anyone had similar linker problems occur? If so, how did you resolve them, if they are resolvable at all? It appears that I am starting to hit a wall, so any help that anyone can offer would be greatly appreciated. Thanks, Paul Nardini paul.nardini@itt.com