comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <mheaney@on2.com>
Subject: Re: Pointer
Date: Mon, 19 May 2008 09:22:55 -0700 (PDT)
Date: 2008-05-19T09:22:55-07:00	[thread overview]
Message-ID: <4e03a9d5-cd75-41b4-b5f1-6a7b38bfc103@k37g2000hsf.googlegroups.com> (raw)
In-Reply-To: 483152DC.4040607@gmail.com

On May 19, 6:13 am, Sébastien <seb.mor...@gmail.com> wrote:
>
> Yes it's exaclty what I did ... and it's exaclty what I would like to
> avoid :-) Actually, I was looking for a pure Ada solution.
> I think there is a way using an unchecked type conversion, but how to be
> sure of the size of the System.Address?

If you don't want to use an address clause, you could do something
like:

procedure Op (argv_Address : System.Address) is
   type Argv_Type is array (Positive) of chars_ptr;
   pragma Convention (C, Argv_Type);

   type Argv_Pointer is access all Argv_Type;
   for Argv_Pointer'Storage_Size use 0;
   pragma Convention (C, Argv_Pointer);

   function To_Argv_Pointer is
     new Unchecked_Conversion (System.Address, Argv_Pointer);

   Argv : constant Argv_Pointer :=
     To_Argv_Pointer (argv_Address);

begin
   -- same as in my last post
end;



  parent reply	other threads:[~2008-05-19 16:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-19  9:38 Pointer Sébastien
2008-05-19  9:53 ` Pointer Dmitry A. Kazakov
2008-05-19  9:54   ` Pointer Dmitry A. Kazakov
2008-05-19 10:13   ` Pointer Sébastien
2008-05-19 10:32     ` Pointer Dmitry A. Kazakov
2008-05-19 10:34     ` Pointer Ludovic Brenta
2008-05-19 11:31       ` Pointer Sébastien
2008-05-19 12:09         ` Pointer Ludovic Brenta
2008-05-19 12:09         ` Pointer Dmitry A. Kazakov
2008-05-19 12:47           ` Pointer Sébastien
2008-05-19 16:25         ` Pointer Matthew Heaney
2008-05-19 16:22     ` Matthew Heaney [this message]
2008-05-19 16:17 ` Pointer Matthew Heaney
2008-05-19 17:23   ` Pointer Sébastien
  -- strict thread matches above, loose matches on Subject: below --
2005-08-31 17:02 pointer TC
2005-08-31 18:40 ` pointer Martin Krischik
2005-08-31 18:52 ` pointer 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