Bug in g2c.h for calling Fortran vom C++ (not C)
Peter Englmaier
ppe@mpe.mpg.de
Mon Apr 8 06:17:00 GMT 2002
Hi,
I used C++ to call FORTRAN and it worked fine until I upgraded to
Redhat 7.2 from Redhat 6.2. As explained in the g77 manual, I used the
g2c.h header to call the fortran subroutines from C and C++:
#ifdef __cplusplus
extern "C" {
#endif
#include <g2c.h>
void f77open_dmp(int *,int *,char *,float *, ftnlen);
#ifdef __cplusplus
}
#endif
This worked fine with older Versions of both C and C++, but with the
new version gcc 2.96 (included in Redhat 7.2) as well as gcc 3.0.1 (also
included in Redhat 7.2) it stopped working with C++. Apparently, some
internal variables are no longer pre-defined, namely:
__g77_integer, __g77_uinteger, __g77_longint, __g77_ulongint.
As a workaround I now define those types myself and it compiles OK.
Please let me know, if this is (i) a gcc bug which will is/will be
fixed with more recent versions), or (ii) a bug from Redhat. In the
later case I will report the bug to Redhat as well.
Best Wishes,
Peter Englmaier.
--
Dr. Peter Englmaier, | email: ppe@mpe.mpg.de
MPI f. extraterrestrische Physik, | phone: +49 (89) 30000-3288
Postfach 1312, | fax: +49 (89) 30000-3601
D-85741 Garching, Germany | web: http://www.mpe.mpg.de/~ppe/
More information about the Gcc-bugs
mailing list