public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Calling g++ compiled objects from f77
@ 2001-11-16 12:16 Tapani Tiensuu
  0 siblings, 0 replies; only message in thread
From: Tapani Tiensuu @ 2001-11-16 12:16 UTC (permalink / raw)
  To: gcc-help

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
================================================================

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-11-23 11:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-16 12:16 Calling g++ compiled objects from f77 Tapani Tiensuu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).