The visibility type attribute (C++ only) (IBM extension)

With the visibility type attributes, you can control whether and how a structure/union/class or an enumeration that is defined in one module can be referenced or used in other modules. Visibility attributes affect only types with external linkage. By using this feature, you can make a shared library smaller and decrease the possibility of symbol collision. For details, see Using visibility attributes.

Read syntax diagramSkip visual syntax diagram
visibility type attribute syntax

>>-__attribute__------------------------------------------------>

>--((--+-visibility-----+--(--+-"default"---+--)--))-----------><
       '-__visibility__-'     +-"protected"-+          
                              +-"hidden"----+          
                              '-"internal"--'          

Example

In the following example, the visibility attribute of class A is protected, and that of enumeration E is hidden:
class __attribute__((visibility("protected"))) A {};
enum __attribute__((visibility("hidden"))) E {e1,e2} e;