Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!sun-barr!rutgers!att!pegasus!ech From: ech@pegasus.ATT.COM (Edward C Horvath) Newsgroups: comp.lang.c++ Subject: extern "language" (was: C --> C++) Message-ID: <2858@pegasus.ATT.COM> Date: 4 May 89 11:39:22 GMT References: <2857@pegasus.ATT.COM> Organization: AT&T ISL Middletown NJ USA Lines: 29 From article <2857@pegasus.ATT.COM>, by hansen@pegasus.ATT.COM (Tony L. Hansen): > The extern "language" linkage specification works both ways. Not only can > one specify that a function has been written in C, one can also specify that > a C++ function is to be linked just as a C function would be linked. For > example, > #include > extern "C" void foo() { printf("foo\n"); } > ...the function "foo" will be known externally as > the unmangled name "foo". Both cfront 2.0 and Zortech's next C++ compiler > work this way. > By the way, the next version of Zortech's C++ compiler will also support the > extern "Pascal" > > linkage specification, in addition to the extern "C" and "C++" linkage > specifications. How nice; I'd hope that Apple's announced (shipping delta days after AT&T ships) MPW cfront will also support 'extern "pascal"': it'll make interfacing with the toolbox ever-so-much easier. It's less obvious how one will write more abstruse bits of code (like OS trap glue), but that's less than obvious in anything but assembler... =Ned Horvath=