comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <martin@krischik.com>
Subject: Re: Ada equivalent for C-pointer?
Date: Sun, 16 Jan 2005 09:44:21 +0100
Date: 2005-01-16T09:44:21+01:00	[thread overview]
Message-ID: <1621573.egxgrGf4Ni@linux1.krischik.com> (raw)
In-Reply-To: gemini.iadas3002srzn02bc.nick.roberts@acm.org

Nick Roberts wrote:

> Pascal Obry <pascal@obry.net> wrote:
> 
>> I don't think so. Here Number will be passed by value, no?
> 
> No, I don't think so (with GNAT/GCC).
> 
>> And you also need the returned value ;)
> 
> Yes, oops!
> 
>> So, you probably want:
>> 
>>     function Wibble (Number: access Interfaces.C.int)
>>           return Interfaces.C.int;
>> 
>>     pragma Import(C,Wibble,"wibble");
> 
> I think the 'in out' mode would work with GNAT/GCC, but I'd suggest
> testing it to make sure.

I did the testing - it does work

> I suppose using the 'access' mode might be 
> clearer, and it might be slightly more efficient.

Anonymous access efficient? If you have a copy read John Barnes Ada 95 (2nd
edition), Page 190, 3rd chapter to end of page.

Yes, I know, it does not apply to export/import C functions.

Martin

-- 
mailto://krischik@users.sourceforge.net
http://www.ada.krischik.com



  parent reply	other threads:[~2005-01-16  8:44 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-14 16:41 Ada equivalent for C-pointer? Alfred Hilscher
2005-01-14 17:00 ` Duncan Sands
2005-01-14 20:05   ` tmoran
2005-01-15  5:00     ` Brian May
2005-01-14 22:33 ` Keith Thompson
2005-01-14 23:03   ` Stephen Leake
2005-01-15 15:51     ` Nick Roberts
2005-01-15 18:54       ` tmoran
2005-01-16  1:43         ` Keith Thompson
2005-01-17 21:35       ` Randy Brukardt
2005-01-15  9:09 ` Martin Krischik
2005-01-15 16:03 ` Nick Roberts
2005-01-15 16:27   ` Pascal Obry
2005-01-15 16:50     ` Nick Roberts
2005-01-15 17:11       ` Simon Wright
2005-01-15 18:46         ` Nick Roberts
2005-01-15 17:49       ` Pascal Obry
2005-01-16  8:44       ` Martin Krischik [this message]
2005-01-16  9:58         ` Pascal Obry
2005-01-16 11:07           ` Martin Krischik
2005-01-16  8:36     ` Martin Krischik
2005-01-16 15:01       ` Niklas Holsti
2005-01-16 16:02         ` Martin Krischik
2005-01-17 15:33           ` Niklas Holsti
2005-01-16 20:39         ` Nick Roberts
2005-01-17 21:38     ` Randy Brukardt
2005-01-17 21:45       ` Pascal Obry
2005-01-17 13:11 ` Alfred Hilscher
2005-01-18  7:31   ` Keith Thompson
replies disabled

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