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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8ecbc35ea893182f X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news1.google.com!news2.google.com!news.glorb.com!newscon02.news.prodigy.net!prodigy.net!newsfeed-00.mathworks.com!peer-uk.news.demon.net!kibo.news.demon.net!mutlu.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Interfacing to C: big structures Date: Tue, 26 Feb 2008 19:47:32 +0000 Organization: Pushface Message-ID: References: <62idb0F23ddfnU1@mid.individual.net> <56a177e4-506f-4bc8-a531-7f2dd15d50c8@i7g2000prf.googlegroups.com> NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1204055252 24067 62.49.19.209 (26 Feb 2008 19:47:32 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Tue, 26 Feb 2008 19:47:32 +0000 (UTC) Cancel-Lock: sha1:DiGlTeHGgmH05rg8GOuCnOV3zKc= User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.50 (darwin) Xref: g2news1.google.com comp.lang.ada:20105 Date: 2008-02-26T19:47:32+00:00 List-Id: Adam Beneschan writes: > I thought of something like this, but Maciej said something about > wanting to avoid dynamic memory, and it seems that you're defining a > type whose size isn't going to be known until runtime, and therefore > if you declare an Ada variable of that type, it will have to be > allocated dynamically in some way. That was the cunning trick: the size is known at *elaboration* time! procedure Main_Program is type T is Ada.Streams.Stream_Element_Array (1 .. Size_Returned_From_C); V : aliased T;