RAD Studio |  |

extern

Category

Storage class specifiers

Syntax

Copy Code

    extern <data definition> ;
    [extern] <function prototype> ;

Description

Use the extern modifier to indicate that the actual storage and initial value of a variable, or body of a function, is defined in a separate source code module. Functions declared with extern are visible throughout all source files in a program, unless you redefine the function as static.

The keyword extern is optional for a function prototype.

Use extern "C" to prevent function names from being mangled in C++ programs.

Also, extern templates allow you to define templates that are not instantiated in a translation unit. Using extern templates thus reduces both compilation time and the size of the compiled module. The extern template feature is part of the new C++0x standard.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!