comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: C binding issue
Date: Sun, 11 May 2003 02:44:00 GMT
Date: 2003-05-11T02:44:00+00:00	[thread overview]
Message-ID: <3EBDB959.3090406@spam.com> (raw)
In-Reply-To: yaiva.58480$8x5.57919@fe10.atl2.webusenet.com

David C. Hoos wrote:
 > "kat-Zygfryd" <6667@wp.pl> wrote in message
 > news:b9k0rv$bls$1@news.onet.pl...
 >
 >> Thanks, I just thought that access types and C pointers are
 >> incompatible.
 >
 > Questions of this type are answered in the Ada Reference manual.
 >
 > This particular case is covered in B.3 (68), viz.:
 >
 > An Ada access T parameter, or an Ada out or in out parameter of an
 > elementary type T, is passed as a t* argument to a C function, where
 > t is the C type corresponding to the Ada type T. In the case of an
 > elementary out or in out parameter, a pointer to a temporary copy is
 > used to preserve by-copy semantics.

This refers to access parameters; the example used a named access type.
These can be made C-compatible by applying pragma Convention to them:

type Void_Ptr is access all Integer;
pragma Convention (C, Void_Ptr);

-- 
Jeff Carter
"Beyond 100,000 lines of code you
should probably be coding in Ada."
P. J. Plauger




  reply	other threads:[~2003-05-11  2:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-10 20:30 C binding issue kat-Zygfryd
2003-05-10 22:46 ` David Holm
2003-05-10 23:09   ` kat-Zygfryd
2003-05-11  2:12     ` David C. Hoos
2003-05-11  2:44       ` Jeffrey Carter [this message]
2003-05-11 15:02   ` Sergey Koshcheyev
2003-05-11 16:27     ` kat-Zygfryd
2003-05-11 19:01     ` David C. Hoos
2003-05-11 22:40 ` Antonio Vargas
replies disabled

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