This is the mail archive of the gcc@gcc.gnu.org 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]

g77 mangling problem


I just noticed a rather bothersome characteristic of g77. I'm trying
to link some Fortran functions and subroutines into a C code. If the
Fortran function name has any underlines in it g77 appends two
underline characters, e.g., "__", otherwise it appends only one
underline character. So if I have a Fortran source file with:

subroutine fort_foo_func(i, j)

subroutine fortbarfunc(i, j)

they get the symbols fort_foo_func__ and fortbarfunc_, respectively,
when compiled.

This makes it completely different from all of the compilers I've used
on other platforms and complicates any attempt at making a portable
code, as portable as you can get when linking Fortran to C anyway. Is
there any way around this problem? I can deal with appending either
two or one underline character, but when both of the methods are used
simultaneously depending on the name of the Fortran function, it
greatly complicates matters.

I apologize if this is not the proper forum for this problem. I had a
difficult time finding any forum related to the GNU compilers and
finally ran into this one. If there is a more appropriate place to
request assistance for this problem I'd appreciate a pointer to it.

Thanks,
Gary Hennigan


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