From: "Pasi J. Hakala" <pjh@msslac.mssl.ucl.ac.uk>
Subject: importing fortran routines to GNAT
Date: 1997/02/21
Date: 1997-02-21T00:00:00+00:00 [thread overview]
Message-ID: <330DBC84.219B@msslac.mssl.ucl.ac.uk> (raw)
[-- Attachment #1: Type: text/plain, Size: 986 bytes --]
Hi!
I'm a sworn FORTRAN-programmer finally trying to learn a more
advanced language (ADA). Now, I still have lots of fortran
subroutines that I want to use, but somehow all the information
on how to do that in GNAT (3.05 I think) doesn't seem to apply
to me... :(
I've attached two files to this message: amain.adb is a
very simple main program that calls subsum.f (an even more simple
fortran subroutine). Now, HOW CAN I MAKE THE ADA MAIN
PROGRAM TO SEE THE SUBROUTINE???!!!
Here's what I've done (This is under OS/2 with g77, gcc 2.7... and
emx 0.9c):
- gcc -c amain.adb (no complaints)
- g77 -c subsum.f (no complaints)
- gnatbind amain.ali (no complaints)
- gnatlink amain.ali subsum.o
which results in 'cannot find object _subsum etc....
So can please someone help a poor astronomer on a way from
fortran to ADA....or otherwise I'll stick to fortran for
another Hubble-time......
Cheers, Pasi
[-- Attachment #2: amain.adb --]
[-- Type: text/plain, Size: 489 bytes --]
with Text_Io; use Text_Io;
with Interfaces.Fortran; use Interfaces.Fortran;
procedure Amain is
package Int_Io is new Integer_IO (Integer); use Int_Io;
package Flt_Io is new Float_IO (Float); use Flt_Io;
procedure subsum(In1 : in Real; In2 : in Real ; Outsum : out Real);
pragma import(Fortran,subsum);
i1,i2,ou : Real;
begin
ou:=0.0;
i1:=1.0;
i2:=2.0;
--
-- Call the imported fortran routine
--
subsum(i1,i2,ou);
New_Line;
Put(Float(ou));
end;
\x1a
[-- Attachment #3: subsum.f --]
[-- Type: text/plain, Size: 114 bytes --]
SUBROUTINE SUBSUM(IN1,IN2,OUT)
REAL IN1,IN2,OUT
C
OUT=IN1+IN2
RETURN
END
\x1a
next reply other threads:[~1997-02-21 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-02-21 0:00 Pasi J. Hakala [this message]
1997-02-21 0:00 ` importing fortran routines to GNAT Robert Dewar
1997-02-21 0:00 ` Joerg Rodemann
1997-02-23 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