Newsgroups: comp.std.c++
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!think.com!snorkelwacker.mit.edu!bloom-picayune.mit.edu!athena.mit.edu!raeburn
From: raeburn@athena.mit.edu (Ken Raeburn)
Subject: Re: Calling c++ from a c program
In-Reply-To: rs@heike.informatik.uni-dortmund.de's message of 26 Jun 91 14:18:39 GMT
Message-ID: <RAEBURN.91Jun26211431@steve-dallas.mit.edu>
Sender: news@athena.mit.edu (News system)
Organization: Massachusetts Institute of Technology
References: <3575@laura.UUCP>
Date: Thu, 27 Jun 91 01:14:36 GMT
Lines: 19

In article <3575@laura.UUCP> rs@heike.informatik.uni-dortmund.de (Roland Schwan) writes:

   ...c-file:

   main()
   {....
   ..
   something();
   ....
   }

The problem here is that some C++ implementations (UNIX ones at least
-- I haven't used others, and you didn't say what you were using)
require that `main' be compiled as C++ code, in order for constructors
for static objects to be run.

If you can't move this `main' routine into a C++ file, rename it to
`main2' or something, and add a new `main' routine in a C++ file which
simply calls `main2'.
