Xref: utzoo comp.lang.c++:2025 comp.lang.fortran:1506 Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!amdcad!sun!pitstop!sundc!seismo!uunet!mcvax!ukc!cs.tcd.ie!tcdmath!hugh From: hugh@maths.tcd.ie (Hugh Grant) Newsgroups: comp.lang.c++,comp.lang.fortran Subject: Re: f77 and C++ w/ cin/cout: can it be done? Summary: Yes it can be done! Keywords: f77 C++ cin cout printf designer C++ Message-ID: <132@maths.tcd.ie> Date: 16 Nov 88 17:26:58 GMT References: <1118@rivm05.UUCP> Reply-To: hugh@maths.tcd.ie (Hugh Grant) Organization: Glockenspiel Ltd., Ireland. Lines: 55 In article <1118@rivm05.UUCP> ccea3@rivm05.UUCP (Adri Verhoef) writes: > [Describes problems using f77 and C++ together that causes a core > dump when using the streams routines] As other people have pointed out, the problem arises from the fact that the static constructors used in streams are not being initialised properly inside the program resulting in a core dump. The suggestions put forward do NOT work with any of the following: designer C++ Glockenspiel C++ domain C++ Advantage C++ (which are all the same progam under different names). If you don't use one of these, then refer to the previous postings. There are two cases: --------- CASE 1: Calling C++ code from within a Fortran program The C++ initialisation routine is called _entry() in these versions and so the following (based on a previous posting) is required: Declare the following function in your C++ code cxxinit() { _entry(); } and call CXXINIT from within your F77 code before you call any C++ routines. -------- CASE 2: Calling fortran libraries from within a C++ program You should have no problems providing the "mxx" constructor linker is run on the resulting executable, which should have happened if you used the "ccxx" driver program to do the linking, e.g. f77 -c myfortran.f ccxx -o myprog myfortran.o f1.cxx f2.cxx If you link the code by hand, just remember to run "mxx" afterwards. Hope this helps, Hugh -- Hugh Grant hugh@maths.tcd.ie, hugh@puschi.uucp Glockenspiel Ltd., Ireland Phone: +353-1-364515 void Posting::Disclaimer() { Default(); }