comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@merv.cs.nyu.edu (Robert Dewar)
Subject: Re: How to pass access parameters to/from C safely/portably?
Date: 1998/06/06
Date: 1998-06-06T00:00:00+00:00	[thread overview]
Message-ID: <dewar.897137805@merv> (raw)
In-Reply-To: 3577D39C.3CECE1C0@praxis-cs.co.uk


<<For example, with ObjectAda, I find that applying pragma Export
forces an anonymous access parameter to not have accessibility
checks applied, and the actual parameter can be a simple C
pointer-to-something - this seems to be the obvious implementation,
but it's worth checking...anyone confirm if GNAT does the same?
>>

Yes, of course it does. However, note that access parameters are NOT
an appropriate mapping for pointer types in C calls in general, since
Ada does not permit a null value to be passed as an access parameter.
It may work to suppress access checking (for the call, or for the
procedure), but this is getting quite non-portable. The only "correct"
Ada way of representing a pointer parameter in a C routine is as
a (named) access type on the Ada side. Yes, this is a nuisance, it
may even be considered to be a real oversight in the language design.
It has caused endless trouble in bindings!





      reply	other threads:[~1998-06-06  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-06-01  0:00 How to pass access parameters to/from C safely/portably? Rod Chapman
1998-06-05  0:00 ` Rod Chapman
1998-06-06  0:00   ` Robert Dewar [this message]
replies disabled

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