C/C++ and Fortran

 View Only

Using visibility attributes (IBM extension)

By Archive User posted Sun September 21, 2014 11:13 PM

  

Originally posted by: TracyR


IBM XL C/C++ for Linux, V13.1 supports an extended feature "Visibility attributes of entities" to assist with performance tuning and application optimization.

The visibility attributes of entity describe whether and how an entity defined in one module can be referenced or used in other modules. Visibility attributes affect entities with external linkage only, and 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.

By using this feature, you can obtain the following benefits and advantages:

·    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 and C++ support different types of entities:

  • In C++, the compiler supports visibility attributes for the following entities:

    • function

    • variable

    • structure/union/class

    • enumeration

    • template

    •   namespace

  • In C, 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.

For more information about the visibility variable attribute, you can see the XL C/C++ Language Reference.

0 comments
2 views

Permalink