logo       

Re: Problems to link C++ files to a Fortran 77 file: msg#00201

gcc.help

Subject: Re: Problems to link C++ files to a Fortran 77 file

From Gustavo,

I bet that all the "API" routines that interface between both FORTRAN and
C++ need to follow the C ABI and C name-mangling.

I thought that too. but the the define __g77_integer is
declared nowhere. I ran grep under the instalation directory.

On the C++ side, you'll need to make sure the header file has ....
near or at the bottom.

Yes there are those ifdefs and defines.

Note: you won't be able to pass std::cout to FORTRAN routines to utilize...

In fact, what I want is to pass symbolsfrom FORTRAN to C++.
The name of the routine in FORTRAN is zgees.
This function is called by my program in the function
main in the file mom.cpp. Zgees has some FORTRAN intrisic routines
such as: abort, write and abs. I also compiled with an array bound check option,
which adds another function of the FORTRAN's library: _s_rnge.

The second problem is:
If I link with gcc (or g++), FORTRAN's intrisic functions are not collected.
There is no mangling problem because I checked out the names in the object
file (zgee.o) and in the archive (libg2c.a). And I saw they match exactly.

On the other hand if I link with g77, as the manual suggests, then the
g77 collecter doesn't find intrisic symbols of C++. Again there´s no mangling
problem, I checked out for myself the symbols in the object file, mom.o and
in the archive file, libstdc++.a

If I further force to link, using ld. The results are the same, even if
I tell ld to include the right archives, libg2c.a and libstdc++.a.

My gcc version is 3.2 released in 27/09/2003.

So what is the problem?

Thanks,

Gustavo.




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise