C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
extern
                                             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.
                                    -♦-