When to use extern “C” in C++? [duplicate]
问题 This question already has answers here : Closed 10 years ago . Possible Duplicate: Why do we need extern “C”{ #include <foo.h> } in C++? I have often seen programs coded like: extern "C" bool doSomeWork() { // return true; } Why do we use an extern "C" block? Can we replace this with something in C++? Is there any advantage to using extern "C" ? I do see a link explaining this but why do we need to compile something in C when we already have C++? 回答1: extern "C" makes names not mangled. It