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,ebf0c2e0d9df034 X-Google-Attributes: gid103376,public From: "Matthew Heaney" Subject: Re: Ada95 + FORTRAN 77 Date: 1999/09/06 Message-ID: <37d3b7de@news1.prserv.net>#1/1 X-Deja-AN: 521658185 Content-transfer-encoding: 7bit References: <7r07rr$gap$1@nnrp1.deja.com> Content-Type: text/plain; charset="US-ASCII" X-Complaints-To: postmaster@ibm.net X-Trace: 6 Sep 1999 12:47:26 GMT, 129.37.213.104 Organization: Global Network Services - Remote Access Mail & News Services Mime-version: 1.0 Newsgroups: comp.lang.ada Date: 1999-09-06T00:00:00+00:00 List-Id: In article <7r07rr$gap$1@nnrp1.deja.com> , lafage8770@my-deja.com wrote: > procedure Adder (A : in Float; B: in Float; Sum : out Float); You should be using the types in Interfaces.Fortran, and you should also have a pragma Convention. > pragma Import (Fortran, Adder, Link_Name => "adder_"); > > A : Float := 12.0; > B : Float := 13.0; > Sum : Float; > begin > Adder (A, B, Sum); > Put (A); Put (B); Put ('='); Put (Sum); New_Line; > > end Ftest; > ------------------------------------------------------------------- > file adder.f: > SUBROUTINE ADDER (A, B, SUM) > REAL*4 A > REAL*4 B > REAL*4 SUM The reason you need to use the scalar types declared in Interfaces.Fortran is that you have no guarantee that REAL*4 is the same as an Ada Float type. > SUM = A + B > END > file common_basic.ads: > with Interfaces.Fortran; use Interfaces.Fortran; > > package Common_Basic is > type Basic_Common is record > X, Y, Z : Double_Precision; > end record; > Basic : Basic_Common; You have the scalar types right, but you still need a pragma Convention for your record type. Otherwise, how do you know that the representation of the record on the Ada side matches the rep on the Fortran side? > pragma Import(Fortran, Basic, Link_Name => "basic_"); > end Common_Basic;