Stats

18 Contributors: 1 Monday, February 27, 2017
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap

Linkage specifications

Introduction

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.

Syntax

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

Remarks

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.

Related Examples