Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-1031

[gcc 4.0] make use of gcc 4.1 -fvisibility option

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: In Progress
    • Major
    • Resolution: Unresolved
    • 4.2.1
    • 4.2.2
    • Build and Installation
    • None
    • gcc 4.0 and better on ELF targets

    • Inefficiency

    Description

      The gcc 4.1 -fvisibility option is said to

      ...very substantially improve linking and load times of shared object libraries, produce more optimized code, provide near-perfect API export and prevent symbol clashes. It is strongly recommended that you use this in any shared objects you distribute.

      In order for stdcxx users to benefit as described in the gcc manual we should make use of the -fvisibility=hidden option in conjunction with __attribute__((visibility("default"))) on exported interfaces as the gcc manual recommends.

      Besides adding the -fvisibility=hidden option to the command line when building shared libraries with gcc, the implementation involves defining the _RWSTD_EXPORT macro for gcc as follows:

      #define _RWSTD_EXPORT __attribute__ ((visibility ("default")))
      

      Note that since gcc requires the __attribute__ decoration only on function declarations and issues a warning when it appears on definitions so the _RWSTD_EXPORT macro must not be used on definitions.

      Attachments

        Activity

          People

            sebor Martin Sebor
            sebor Martin Sebor
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: