This is the mail archive of the gcc-help@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]
Other format: [Raw text]

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


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