From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,747be3e35071507b X-Google-Attributes: gid103376,public From: cwarack@kirk.usafa.af.mil (Chris Warack ) Subject: Re: Calling C function with structure parameter from ADA Date: 1995/04/07 Message-ID: <3m48lp$jdh@usafa2.usafa.af.mil>#1/1 X-Deja-AN: 100070410 distribution: world sender: cwarack@kirk (Chris Warack ) references: <3lbu1o$n3p@theopolis.orl.mmc.com> organization: USAF Academy, CO newsgroups: comp.lang.ada Date: 1995-04-07T00:00:00+00:00 List-Id: In article , 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