This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

linking c code against fortran libraries

Hi all.

I have some questions about linking c code against fortran libraries.
Suppose I have a code foo.c which calls routines in a fortran library 

First question:
g77  foo.o -lfortlib
equivalent to
gcc foo.o -lfortlib -lfrtbegin -lg2c -lm -shared-libgcc

or does it actually matter that the compiler was invoked as g77.

At any rate, neither of these is successful and give equivalent error:
gcc-3.2.1/i686-pc-linux-gnu/libf2c/libF77/main.c: undefined reference to 

It was my understanding that linking with g77 was supposed to tie up the 
stuff so that the entry point into the executable was somewhere in 
libfrtbegin which then called foo.o:main() after libg2c initialization. 
The library is a debian build (OK, I might as well be specific -- it's 
lapack) but the behavior doesn't seem to depend on whether I compile and 
link with any of the debian build gcc's (2.95, 3.0, 3.0.4) or a handbuilt 

If no one has the magic solution for me, what might be even better is if 
someone at least has some pointers to discussions where these issues are 
raised (other than (e.g.): 
at a level accessible to physicists ;)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]