IDL code with fortran subroutine and C linker on OSX [message #44550] |
Tue, 28 June 2005 13:20  |
laurel
Messages: 3 Registered: June 2005
|
Junior Member |
|
|
In nutshell, my problem is with linking all of my different language
codes together. One of the languages seem to thing there should be a
leading underscore on a subroutine name, and I just don't know why.
Here's a more detailed explanation of what is going on.
I have an IDL code, and a fortran subroutine called mainsub. I have a C
linker as a go-between from IDL and fortran called field_c. They both
compile fine on their own, but don't seem to want to be linked. Here is
my set of compiling commands so far:
f90 -c mainsub.f
gcc -c field_c.c
(these both work fine)
gcc -bundle -flat_namespace -fno-leading-underscore -o field_c.so
field_c.o mainsub.o KT_2003_sub.o
(KT is another fortran subroutine called in mainsub)
My problem is that when I enter the last line I get:
"ld: Undefined symbols:
_mainsub_
___A_FWF
__CLOSE...."
and several more.
In field_c.c, I call "mainsub_" because I think that fortran adds the
extra "_" as a suffix. I have tried with and without the suffix, and
with and without a prefix. I can't call the subroutine "_mainsub" in
the fortran code because subroutines can't start with underscores. I
really don't know where these extra underscores are coming from, and
what the subroutines are called in the .o files.
So, does anyone know where I could find the symbol tables for my .o
files (both C and fortran?). Or, even better, has anyone done this on a
Mac OSX, ran into this problem, and been able to fix it. Any help would
be appreciated as I think I might be nearing the end of my creativity
on the matter.
Thanks so much,
Laurel
|
|
|