logo       

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

gcc.help

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




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

News | FAQ | advertise