This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Problems to link C++ files to a Fortran 77 file
- From: Eljay Love-Jensen <eljay at adobe dot com>
- To: Gustavo Bevilacqua Leal <gustavob at cetuc dot puc-rio dot br>, gcc-help at gnu dot org
- Cc: toon at moene dot indiv dot nluug dot nl
- Date: Thu, 22 May 2003 18:51:39 -0500
- Subject: Re: Problems to link C++ files to a Fortran 77 file
Hi 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.
On the C++ side, you'll need to make sure the header file has
#ifdef __cplusplus
extern "C" {
#endif
near the top (after any other header file includes), and
#ifdef __cplusplus
}
#endif
near or at the bottom.
Note: you won't be able to pass std::cout to FORTRAN routines to
utilize. If you need to pass std::cout into FORTRAN to be passed through
back to C++, you''ll need to pass the pointer to std::cout as void* into
FORTRAN, and then back to the C++ side, you'll have to send back as a
void*, then static_cast it back on the C++ side.
Sincerely,
--Eljay