Is it possible to build shared lib using gcc and g77 ?
Jie Zhang
jie@geotomo.com
Mon Aug 2 10:22:00 GMT 1999
Dear Sir/Madam:
ÃÂ
I am asking help to solve a problem associated
with g77 and gcc.
ÃÂ
Problem description: A C program and a
Fortran program, weÃÂ want to compile and linkÃÂ them together under
Solaries 2.6 by using gcc and g77 to create a shared lib
(.so).ÃÂ ÃÂ
We have tried enumerous ways. All failed. (note:
we are aware of the underscore
convention of g77)
ÃÂ
To give you a example, one way I tried
is, ----------------------------------------- gcc -fpic -c
myCProgram.c g77 -fpic -c myFortranProgramc. gcc -G -o libmyGod.a
myCProgram.o myFortranProgram.o -lg2c -lc
-lm ----------------------------------------- The trouble is :
"MAIN__" of libg2c.a cannot be resolved. I also tried using
"ld" as link command rather than "gcc" or "g77".
The created lib just cannot be load correctly. The last way I tried
was to use the utility of f2c to translate all the Fortran code to C
code.ÃÂ However, the library of libf77.a and libi77.a
whichÃÂ ÃÂ
come with f2c get me into the same problem of
before. That is "MAIN__" cannot
be resolved. Now I start to doubt if I am
able to create my shared lib by using gcc and g77. Do I need to switch my
compiler to a commercial product like f77 ? Is there a definite answer to
this ? Your input is highly appreciated. ÃÂ
ÃÂ
-Jie ÃÂ
More information about the Gcc-bugs
mailing list