Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!rice!uw-beaver!mit-eddie!xn.ll.mit.edu!xn!haydens From: haydens@natasha.juliet.ll.mit.edu (Hayden Schultz) Newsgroups: comp.lang.c++ Subject: Re: bug with making C++ functions have C linkage ? Message-ID: Date: 18 Apr 91 14:27:52 GMT References: <1991Apr16.122905.23613@cs.nott.ac.uk> Sender: usenet@xn.ll.mit.edu Organization: M.I.T. Lincoln Lab - Group 42 Lines: 17 In-Reply-To: jac@gandalf.llnl.gov's message of 18 Apr 91 03:30:23 GMT I'm pretty sure that Jim (jac@gandalf.llnl.gov) has the right answer, that because the C++ main does tricky things like call global constructors that the original C main didn't call. So it makes sense that when you try to access a global object that hasn't been initialized correctly, like cout, you get a segv. But isn't there some way to explicitly invoke the global constructors and destructors so you can use a C main and call C++ routines? I can't manage to accomplish this with Sun CC. It would be very nice if I could use C++ routines everywhere I use C routines. For example, I can call C routines from lisp, but since it doesn't have a C++ main, I can't figure out how to call C++ routines. Hayden Schultz (haydens@juliet.ll.mit.edu) MIT Lincoln Lab