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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a71fc4911021ed50 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!z14g2000cwz.googlegroups.com!not-for-mail From: igor.kh@gmail.com Newsgroups: comp.lang.ada Subject: Re: Returning data from Ada to C Date: 9 May 2005 15:49:48 -0700 Organization: http://groups.google.com Message-ID: <1115678988.738692.53950@z14g2000cwz.googlegroups.com> References: <1115164192.585409.163780@z14g2000cwz.googlegroups.com> <9vYde.5480$GQ5.3731@newsread1.news.pas.earthlink.net> <4f1a9$4278d210$cf702d0d$18288@PRIMUS.CA> <1115503927.228956.100050@z14g2000cwz.googlegroups.com> <87is1thimt.fsf@insalien.org> <87ekchhiiq.fsf@insalien.org> NNTP-Posting-Host: 129.100.144.139 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1115678993 9087 127.0.0.1 (9 May 2005 22:49:53 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 9 May 2005 22:49:53 +0000 (UTC) In-Reply-To: <87ekchhiiq.fsf@insalien.org> User-Agent: G2/0.2 Complaints-To: groups-abuse@google.com Injection-Info: z14g2000cwz.googlegroups.com; posting-host=129.100.144.139; posting-account=yKC4HgwAAABh06UMMZG_tyXZIoZug5Yj Xref: g2news1.google.com comp.lang.ada:10983 Date: 2005-05-09T15:49:48-07:00 List-Id: Ludovic Brenta wrote: > Ludovic Brenta writes: > > procedure Hello_World (I : in out Integer; > > A_Ptr : out C_IntArrs.Pointer) is > > type Array_Access is access C_Integer_Arrays.C_Integer_Array; > > Result : Array_Access := new C_Integer_Arrays.C_Integer_Array' > > (0 => 3, 1 => 2, 2 => 1); > > begin > > return Result (Result'First)'Access; > -- the above is wrong! > A_Ptr := Result (Result'First)'Access; -- correct > > end Hello_World; > > obviously. I had to use Unchecked_Access instead of Access (gnat complained "non-local pointer cannot point to local object"), but it worked! Thanks, everyone, for your help. Igor