Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!apple!julius.cs.uiuc.edu!rpi!zaphod.mps.ohio-state.edu!samsung!uunet!mcsun!unido!ira.uka.de!fuchs From: fuchs@it.uka.de (Harald Fuchs) Newsgroups: comp.lang.c++ Subject: Re: mixing c++ and c - SUMMARY Message-ID: Date: 9 Feb 91 12:44:38 GMT References: <5279@s3.ireq.hydro.qc.ca> Sender: news@ira.uka.de (USENET News System) Organization: University of Karlsruhe, FRG Lines: 31 robert@ireq.hydro.qc.ca (R.Meunier 8516) writes: > Contrary to what most people think, it is possible to mix c++ >function with c. Here is how i have done it. >That code is compile with a c++ compiler and put in a library With which C++ compiler? > If i need that class in a standard c program, i call only >the function newA() and incA(). Their name is not mangle since >they are standard function. They _should_ be mangled unless you specify extern "C" { caddr_t newA (int); int incA (A*); } Seems that you have an obsolete C++ compiler. >The c++ library libC.a as to be >provide to the compiler and someone have mention by mail that >the function _main() as to be called manually to initialise >static variables in classes. The problem lies in global (extern) objects with constructors and/or destructors. If your extern "C" functions use them, you lose. -- Harald Fuchs *gulp*