comp.lang.ada
 help / color / mirror / Atom feed
From: igor.kh@gmail.com
Subject: Re: Returning data from Ada to C
Date: 9 May 2005 15:49:48 -0700
Date: 2005-05-09T15:49:48-07:00	[thread overview]
Message-ID: <1115678988.738692.53950@z14g2000cwz.googlegroups.com> (raw)
In-Reply-To: <87ekchhiiq.fsf@insalien.org>

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




  reply	other threads:[~2005-05-09 22:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-03 23:49 Returning data from Ada to C igor.kh
2005-05-04  4:49 ` Jeffrey Carter
2005-05-04 13:45   ` Igor Khavkine
2005-05-04 13:58     ` Alex R. Mosteo
2005-05-06  3:36     ` Jeffrey Carter
2005-05-07 22:12       ` igor.kh
2005-05-08  2:07         ` Jeffrey Carter
2005-05-08 19:58           ` Jeffrey Carter
2005-05-08  9:41         ` Martin Dowie
2005-05-08 14:55           ` Ludovic Brenta
2005-05-08 14:58             ` Ludovic Brenta
2005-05-09 22:49               ` igor.kh [this message]
2005-05-10 12:48                 ` Ludovic Brenta
2005-05-16  4:35   ` Dave Thompson
2005-05-16  5:03     ` Jeffrey Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox