This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: mixed language help needed
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- To: Juan Nastri <jcbatman at conae dot gov dot ar>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Mon, 10 Dec 2001 23:11:36 +0100
- Subject: Re: mixed language help needed
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <3C151A65.13276A91@conae.gov.ar>
Juan Nastri wrote:
> I am writing a new main for an old program written in fortran and I am
> looking for a light somewhere.
> The general idea is to use the old fortran subroutines, and make the new
> main in plain C.
> I have read a lot of pages, speaking about mixed language, and a lot of
> different things where suggested.
Note that, until the full (upcoming) Fortran 200x Standard is completed,
you'll *have* to delve into the manual accompanying your Fortran
compiler to learn how this is done - *for this specific compiler* -
because it is compiler specific.
> But what I need is quite simple. I need a concrete example on how to
> link a subroutine.f with a main_program.c.
> Lets say, that the subroutine uses 2 integer as a parameters.
> Exactly what should I tell to gcc and g77 to correctly compile this??
> and example of a makefile would be usefull too!
main.c:
main(){int i,j;(void)subroutine(&i,&j);printf("%d %d\n",i,j);}
subroutine.f:
SUBROUTINE SUBROUTINE(I,J)
I = 1; J = 2
END
compile & link:
g77 -fno-underscoring main.c subroutine.f
./a.out
1 2
>
> Thank you at least to read this. If you can help me, I would be very
> happy.
Well, I hope you can indicate to us where the g77 manual failed to make
this clear to you ...
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)