Calling g++ compiled objects from f77
Tapani Tiensuu
tapani.tiensuu@vtt.fi
Fri Nov 16 12:16:00 GMT 2001
Dear gccgurus
I hope I'm not asking something stupid, but in that case
question reveals something about me...
Here is my test program
-----------------------------------
PROGRAM C_CALL
call cpp_print("lammas", 40, 24.86)
END
-----------------------------------
And here is source for cpp_print.
-----------------------------------
#include <iostream.h>
extern "C" {
int cpp_print(char *str, int* i, float* d)
{
cout << "c++ -->" << str << "<-->" << *i << "<-->" << *d << "<--\n";
return 666;
}
}
-----------------------------------
Compiling a) 'g++ -c cpp_print.cpp' using 2.95.1 and
b) f77 c_call.f cpp_print.o (-Wl,L ....) produces a right result:
tau:/users/user1/enetti/aho/src/k ./a.out
c++ -->lammas<-->40<-->24.86<--
f77 here is either from HP or Compaq (tested vendors)
However under g++ 3.0.1 all I get is core and segmentation violation.
c_call cores during call.
Something has obviously changed, but what?
Maybe simple compiler-option fixes this?
Thx
Tapani
================================================================
Tapani Tiensuu
VTT/ENERGY Mail tapani.tiensuu@vtt.fi
(Tekniikantie 4 C, ESPOO) Tel. +358-9-4565008
P.O.Box 1604 Fax +358-9-4565000
FIN-02044-VTT, FINLAND
================================================================
More information about the Gcc-help
mailing list