This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: bug? runtime error passing POD
Daniel Franke wrote:
> On Monday 04 July 2005 20:39, FX Coudert wrote:
>>>Question: Bug in gfortran or misunderstanding on my side?
>>
>>Bug in gfortran, your code is good.
>
> Thanks, that's an relief =)
There's a bug on your side, but it's not in the code :-)
>>After a few trials, I guess you used static linking. There seems to be a
>>bad interaction between using a C main program and statically linking
>>libgfortran/libgfortranbegin.
Then FX found a bug different from yours, since ...
> No (explicit) static linking on my side:
>
> -- Makefile--
> GCCPATH = <local-path>
>
> CFLAGS = -g -ansi -pedantic -W -Wall
> FFLAGS = -g -W -Wall
> LDFLAGS = -L$(GCCPATH)/lib -lgfortran -lm
>
> test.gfortran: clean f.f90 test.c
> $(GCCPATH)/bin/gfortran $(FFLAGS) -c f.f90 -o f.o
> $(GCCPATH)/bin/gcc $(CFLAGS) -c test.c -o test.o
> $(GCCPATH)/bin/gcc f.o test.o $(LDFLAGS) -o test.gfortran
... you need to either add -lgfortranbegin to LDFLAGS or use gfortran instead
of gcc as linker command.
Hope this helps,
- Tobi