C++ Linkage specifications


A linkage specification tells the compiler to compile declarations in a way that allows them to be linked together with declarations written in another language, such as C.


  • extern string-literal { declaration-seq(opt) }
  • extern string-literal declaration


The standard requires all compilers to support extern "C" in order to allow C++ to be compatible with C, and extern "C++", which may be used to override an enclosing linkage specification and restore the default. Other supported linkage specifications are implementation-defined.