◄Up► ◄Contents► ◄Index► ◄Back► ─────C/C++ Language───────────────────────────────────────────────────────── Keyword: extern Syntax: extern declarator extern string-literal declarator extern string-literal { declarator-list } Summary: Declares a variable or function and specifies that it has external linkage (its name is visible from files other than the one in which it's defined). When modifying a variable, specifies that the variable has static duration (it is allocated when the program begins and deallocated when the program ends). The variable or function may be defined in another source file, or later in the same file. In C++, when used with a string, specifies that the linkage conventions of another language are being used for the declarator(s). See: ◄Declarations and Definitions► See also: auto, register, static, const, volatile Declarations of variables and functions at file scope are external by default. In C++, <string-literal> is the name of a language. The language specifier "C++" is the default. "C" is the only other language specifier currently supported by Microsoft C/C++. This allows you to use functions or variables defined in a C module. Example extern "C" int printf( const char *, ... ); extern "C" { int getchar( void ); int putchar( int ); } All of the standard include files use the extern "C" syntax to allow the run-time library functions to be used in C++ programs. -♦-