Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!microsoft!jimad From: jimad@microsoft.UUCP (JAMES ADCOCK) Newsgroups: comp.lang.c++ Subject: Re: C++ masquerading as C ... How? Message-ID: <10193@microsoft.UUCP> Date: 9 Jan 90 18:26:10 GMT References: <6170011@hpindda.HP.COM> Reply-To: jimad@microsoft.UUCP (JAMES ADCOCK) Organization: Microsoft Corp., Redmond WA Lines: 20 Although not stated anywhere explicetly, the extern "C" construct works both ways -- it can be used to tell a C++ program to look for a C function of that name, but it can also be used to tell a C++ program to generate a function of that name -- IE turn off name mangling for this one function: #include extern "C" int foo() { return 1234; } int foo2() { return 1234; } main() { printf("%d\n", foo() ); printf("%d\n", foo2() ); } On my machine, in linker land foo is known as "_foo" [ as would be a function written in K&R C ], whereas foo2 is known by the mangled name "_foo__Fv"