extern is a data type modifier that tells the compiler about a variable that is defined elsewhere in the program. This is often used in conjunction with separately compiled files that share the same global data. In essence, it notifies the compiler about the type of a variable without redefining it. For example, if first were defined in another file as an integer, the following declaration would be used in subsequent files:

extern int first;

This declaration specifies first’s type, but storage for it has not been created.

For C++ only, extern is also used to create a linkage specification. It has this general form:

extern "language" function-prototype

Here, language denotes the language to which you want the function to link. C and C++ linkages are guaranteed to be supported. Your compiler may support other linkages, too. To declare several functions using the same linkage specification, you can use this general form:

extern "language" {      function-prototypes }

C(s)C++ Programmer's Reference
C Programming on the IBM PC (C Programmers Reference Guide Series)
ISBN: 0673462897
EAN: 2147483647
Year: 2002
Pages: 539

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net