comp.lang.ada
 help / color / mirror / Atom feed
* Re: Interfacing GNAT Ada and GNU FORTRAN - Problems
       [not found] <mailman.982606994.22082.comp.lang.ada@ada.eu.org>
@ 2001-02-22 11:56 ` Antony Bartolini
  0 siblings, 0 replies; only message in thread
From: Antony Bartolini @ 2001-02-22 11:56 UTC (permalink / raw)


I ran into the same problem while trying to incorporate legacy
F77 code into a new Ada95 project on a windows platform.
In the end, by using f2c and then compiling the resultant C code
with the GNAT's gcc compiler (2.8.1 in my case) I had no
problem whatsoever mixing the two languages. Also, the
Ada Reference Manual section B.5 "Interfacing with Fortran"
provided all the guidance I needed to both call F77 routines
from Ada and Ada routines from F77.

'Hope this helps.

Tony Bartolini



thara nair wrote:

> Sir,
>         I wish to draw your kind attention to three problems
> I faced while using the GNAT Ada and GNU Fortran
> compiler.
>
> 1)      I have been trying to interface FORTRAN and Ada.My
> first attempt was to call a FORTRAN subroutine from an
> Ada main program.I had used GNAT AdaGide 95(version
> 6.21p) downloaded from internet.the FORTRAN compiler
> was GNU FORTRAN compiler for windows98/2000
> doownloaded from  the  website
> www.geocities/athens/olympus/5564/g77.htm . I had
> downloaded 4 zip files viz. g77exe.zip,g77lib.zip, and
> g77doc.zip and unzip.zip.
> They were properly unzipped and could execute FORTRAN
> programs using the g77 compiler.
>
> the ada program was
>
> with text_io, ada.integer_text_io;
> use text_io, ada.integer_text_io;
> procedure afmain is
>         i : integer;
>         procedure test(i : in out integer);
>         pragma interface (FORTRAN,test);
> begin
>         i:=234;
>         put(i);
>         test(i);
>         put(i);
> end afmain;
>
> the fortran program was
>
> subroutine test(i)
> write(*,*)'hai'
> i=i+1
> return
> end
>
> I compiled the Ada main pgm. from the command line
> using GNAT Ada compiler.
>
> The compilation was done as follows :
>
> g77 -c test.for
> gcc -c afmain.adb
> gnatbind afmain.ali
> gnatlink afmain.ali test.o
>
> upto the bind command , there is no error. when the
> link command is executed ,
>
> the error message is as follows;
> ./afmain.o(text+0x54):afmain.adb : undefined reference
> to 'test'
>
> 2)Also your kind attention is drawn towards the
> problem of calling an   Ada subroutine from a FORTRAN
> main program.
>         Whether this is feasible ?
> if possible what are the specific features to be
> considered while developing this interface.
>
> 3) In the above case, is there any limitation in using
> i/o interfaces and is there any limitation on nested
> programs ?
>
> I request your help in solving these problems.
> Expecting a speedy solution,
>
> With regards
> Thara Nair
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35
> a year!  http://personal.mail.yahoo.com/




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-02-22 11:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <mailman.982606994.22082.comp.lang.ada@ada.eu.org>
2001-02-22 11:56 ` Interfacing GNAT Ada and GNU FORTRAN - Problems Antony Bartolini

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