Date: Tue, 12 Jan 1999 11:00:40 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Laurence Withers cc: djgpp AT delorie DOT com Subject: Re: Calling C++ functions from C functions: how? In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com On Mon, 11 Jan 1999, Laurence Withers wrote: > // obj.cc ////////////////////////////////////////////////////////////// > > // C++ function > int cplusplus_tester_function(int a, int b) > { > return (a + b); > } > > // > // C wrapper > // > extern "C" { > int c_tester_function(int a, int b) > { > return cplusplus_tester_function(a, b); > } > } > > // end of obj.cc /////////////////////////////////////////////////////// It should be emphasized that this technique will only work if both the C wrapper and the C++ function it calls are defined in the same source module. Otherwise, you are back to square one.