Subject: Fortran 77 name-mangling scheme
To: None <tech-userlevel@netbsd.org>
From: Patrick Welche <prlw1@newn.cam.ac.uk>
List: tech-userlevel
Date: 05/24/2001 18:36:21
autoconf's "checking for Fortran 77 name-mangling scheme" always fails. It
seems it just tries to compile a fortran and C source file together like eg:
conftest.f:
subroutine foobar()
return
end
conftest.c:
char foobar();
int main ()
{
foobar (); /* call the fortran subroutine */
return 0;
}
quartz% gcc -c -o cc_test.o conftest.c
quartz% gcc -c -o cf77_test.o conftest.f
quartz% nm -g cc_test.o
U foobar
00000000 T main
quartz% nm -g cf77_test.o
00000000 T foobar_
The above is on i386, elf. I take it this is meant to happen, but why?
Then leads to the obvious:
quartz% gcc -o conftest -g -O2 cc_test.o cf77_test.o -lg2c -lm
/usr/lib/libg2c.so: warning: tempnam() possibly used unsafely, use mkstemp()
or mkdtemp()
cc_test.o: In function `main':
cc_test.o(.text+0x4): undefined reference to `foobar'
/usr/lib/libg2c.so: undefined reference to `MAIN__'
collect2: ld returned 1 exit status
s/foobar/foobar_/g in the .c file just gets the MAIN__ error - any thoughts
on that one?
Cheers,
Patrick