comp.lang.ada
 help / color / mirror / Atom feed
From: cwarack@kirk.usafa.af.mil (Chris Warack <sys mgr>)
Subject: Re: Calling C function with structure parameter from ADA
Date: 1995/04/07
Date: 1995-04-07T00:00:00+00:00	[thread overview]
Message-ID: <3m48lp$jdh@usafa2.usafa.af.mil> (raw)
In-Reply-To: dewar.797190489@gnat

In article <dewar.797190489@gnat>, dewar@cs.nyu.edu (Robert Dewar) writes:
|> T.E.D. assumes that C passes structures by address. This is wrong, it varies
|> from one machine environment to another.
|> 
|> The RM essenstially repeats this misconception by requiring Ada to pass
|> a record by address for Convention C, thus, on some machines ensuring
|> that Ada is incompatible with C.
|> 
|> Actually this is not a requirement, it is implementation advice.
|> 
|> It is also one of the few cases in which GNAT quite deliberately declines
|> to follow the implementation advice in the RM.
|> 
|> In GNAT, if you make a procedure convention C, then we pass records
|> EXACTLY THE SAME WAY THAT C would pass them, guaranteeing compatibility
                            ^^^<-- gcc?
|> with C -- This seems a much better approach, and for example, simply
|> and directly solves the original poster's problems.

Shouldn't the above reference refer to gcc's ability to compile c?  That is,
if I happen to be using a different C compiler to generate the object code
that will be linked, then GNAT makes no such guarantee... or does it?
If so, I'm duly impressed. :-))

|> I hope other compilers will make this same sensible decision. If not,
|> watch out, your Ada compiler may go out of its way to ensure that it
|> is incompatible with C!

Unless they are guaranteed to be using the same conventions in the first place
(by using the same technology perhaps), how is this generally possible?

If it is possible, I am truly interested in how.

-- 
Christopher A. Warack, Capt, USAF
Computer Science Department, US Air Force Academy

cwarack@kirk.usafa.af.mil                (719) 472-2401




  reply	other threads:[~1995-04-07  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-03-28 17:22 Calling C function with structure parameter from ADA C.G. Williams
1995-03-29  0:00 ` Theodore Dennison
1995-04-06  0:00   ` Robert Dewar
1995-04-07  0:00     ` Chris Warack <sys mgr> [this message]
1995-04-07  0:00       ` Robert Dewar
     [not found]     ` <D6pwGs.8wE@thomsoft.com>
1995-04-19  0:00       ` Fergus Henderson
replies disabled

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