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.
  • Within a shared library, allow direct access instead of via a TOC pointer.

Supported types of entities

C++ only
The compiler supports visibility attributes for the following entities:
  • Function
  • Variable
  • Structure/union/class
  • Enumeration
  • Template
  • Namespace
C++ only
C only
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


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us