Using visibility attributes (IBM extension)

Visibility attributes describe whether and how an entity that is defined in one module can be referenced or used in other modules. Visibility attributes affect entities with external linkage only, and they cannot increase the visibility of other entities. By specifying visibility attributes for entities, you can export only the entities that are necessary to shared libraries. With this feature, you can get the following benefits:
  • Decrease the size of shared libraries.
  • Reduce the possibility of symbol collision.
  • Allow more optimization for the compile and link phases.
  • Improve the efficiency of dynamic linking.

Supported types of entities

C++ only begins
The compiler supports visibility attributes for the following entities:
  • Function
  • Variable
  • Structure/union/class
  • Enumeration
  • Template
  • Namespace
C++ only ends
C only begins
The compiler supports visibility attributes for the following entities:
  • Function
  • Variable
Note: Data types in the C language do not have external linkage, so you cannot specify visibility attributes for C data types.
C only ends