Non-Confidential | ![]() | 100067_0609_00_en | ||
| ||||
Home > Compiler-specific Function, Variable, and Type Attributes > __attribute__((visibility("visibility_type"))) function attribute |
This function attribute affects the visibility of ELF symbols.
__attribute__((visibility("
")))
visibility_type
Where
is one of the following:visibility_type
default
The assumed visibility of symbols can be changed by other options. Default visibility overrides such changes. Default visibility corresponds to external linkage.
hidden
The symbol is not placed into the dynamic symbol table, so no other executable or shared library can directly reference it. Indirect references are possible using function pointers.
protected
The symbol is placed into the dynamic symbol table, but references within the defining module bind to the local symbol. That is, the symbol cannot be overridden by another module.
Except when specifying default
visibility, this attribute is intended for
use with declarations that would otherwise have external linkage.
You can apply this attribute to functions and variables in C and C++. In C++, it can also be applied to class, struct, union, and enum types, and namespace declarations.
In the case of namespace declarations, the visibility attribute applies to all function and variable definitions.
void __attribute__((visibility("protected"))) foo() { ... }