[cfe-dev] private extern, what is that?
devlists at shadowlab.org
Thu Nov 6 10:52:47 CST 2008
Le 6 nov. 08 à 16:41, Paolo Bolzoni a écrit :
> Function declarations and variable declarations can have private
> extern as storage class.
> I sought in the C and C++ standards for 'private extern' but I found
> What does private extern mean?
> When the clang's AST can have private extern in one of its vertices?
Declaring a symbol as private extern (using the __private_extern__
keyword) is equivalent to declare it using
A private external symbol is a defined external symbol that is visible
only to other modules within the same object file as the module that
contains it. The standard static linker changes private external
symbols into private defined symbols unless you specify otherwise
(using the -keep_private_externs flag).
You can mark a symbol as private external by using the
__private_extern__ keyword (which works only in C) or the
visibility("hidden")attribute (which works both in C and C++ with GCC
4.0), as in this example:
__private_extern__ int x = 0; // C only
int y = 99 __attribute__((visibility("hidden"))); // C and C++, GCC
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev