From: "Matthew Heaney" <matthew_heaney@acm.org>
Subject: Re: Ada95 + FORTRAN 77
Date: 1999/09/06
Date: 1999-09-06T00:00:00+00:00 [thread overview]
Message-ID: <37d3b7de@news1.prserv.net> (raw)
In-Reply-To: 7r07rr$gap$1@nnrp1.deja.com
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;
next prev parent reply other threads:[~1999-09-06 0:00 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-09-06 0:00 Ada95 + FORTRAN 77 Preben Randhol
1999-09-06 0:00 ` Gisle S�lensminde
1999-09-06 0:00 ` Preben Randhol
1999-09-06 0:00 ` lafage8770
1999-09-06 0:00 ` Matthew Heaney [this message]
1999-09-06 0:00 ` Robert Dewar
1999-09-06 0:00 ` Preben Randhol
1999-09-06 0:00 ` Robert Dewar
1999-09-06 0:00 ` Preben Randhol
1999-09-06 0:00 ` Robert Dewar
1999-09-07 0:00 ` Preben Randhol
1999-09-08 0:00 ` Robert Dewar
1999-09-07 0:00 ` okellogg
1999-09-08 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