comp.lang.ada
 help / color / mirror / Atom feed
From: Robert Dewar <robert_dewar@my-deja.com>
Subject: Re: Question about interfacing C and Ada95
Date: 1999/11/08
Date: 1999-11-08T00:00:00+00:00	[thread overview]
Message-ID: <8076h5$d3c$1@nnrp1.deja.com> (raw)
In-Reply-To: 806ud0$lu1$1@trog.dera.gov.uk

In article <806ud0$lu1$1@trog.dera.gov.uk>,
  "Hovers" <hovers@dera.gov.uk> wrote:
> if I have a c routine that returns more than one value what is
thge best way
> to interface to Ada with it.
>
> e.g. int getX ( void **instance, int *float );
>
> we have recoded the c to this as Ada funcs do not allow more
> than one return

Both Ada and C allow exactly one value to be returned.

Both Ada and C allow pointers to be passed by value, allowing
the called subprogram (function or procedure in Ada) to modify
the calling parameter.

Ada in addition for procedures only, has a feature (out
parameters) that is not allowed in C at all.

But it does not seem there is any significant problem here!

Yes, it would be nice if you could model pointer parameters in
C with out parameters in functions in Ada, but you can't and
you certainly don't need to. Just call the function as you
would in C, passing a pointer if the parameter is of a pointer
type.

If necessary (but please ONLY if necessary) use aliased and
'Access to pass a pointer to a declared variable.





Sent via Deja.com http://www.deja.com/
Before you buy.




  parent reply	other threads:[~1999-11-08  0:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-11-08  0:00 Question about interfacing C and Ada95 Hovers
1999-11-08  0:00 ` Matthew Heaney
1999-11-08  0:00 ` Robert Dewar [this message]
1999-11-09  0:00   ` Hovers
1999-11-09  0:00     ` Ted Dennison
1999-11-12  0:00       ` Hovers
1999-11-12  0:00         ` Robert Dewar
1999-11-12  0:00           ` Ted Dennison
1999-11-13  0:00             ` Robert Dewar
1999-11-09  0:00     ` Matthew Heaney
1999-11-08  0:00 ` tmoran
1999-11-09  0:00   ` Robert Dewar
replies disabled

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