Date: Wed, 25 Apr 2001 09:30:44 +0300 (IDT) From: Eli Zaretskii X-Sender: eliz AT is To: Alistair_P SHILTON cc: djgpp AT delorie DOT com Subject: Re: selectively turning off function name mangling in C++ In-Reply-To: <9c5o5s$fvc$1@mulga.cs.mu.OZ.AU> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On 25 Apr 2001, Alistair_P SHILTON wrote: > I was wondering if it is possible to tell gxx to not mangle the names of > certain functions? That's what ``extern "C"'' is for. > I've been trying to interface some of my C++ code with > some fortran code I downloaded of the net. g77 mangles its function names > by adding _'s to start and finish (so foo becomes _foo_). But gxx mangles > the same function to _foo__*** (*** = annoying junk) - which stops the .o > files from linking correctly! When you call your Fortran functions from C++, use the g77-mangled name, and declare a prototype for those functions with ``extern "C"''. For example: extern "C" double _foo_ (int *, double *); ... double value = _foo_ (bar, baz);