Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference

ID 767253
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

fvisibility

Specifies the default visibility for global symbols or the visibility for symbols in declarations, functions, or variables.

Syntax

Linux:

-fvisibility=arg

-fvisibility-global-new-delete-hidden

-fvisibility-inlines-hidden

-f[no]visibility-inlines-hidden-static-local-var

-fvisibility-ms-compat

Windows:

None

Arguments

arg

Specifies the visibility setting. Possible values are:

default

Sets visibility to default. The symbol is visible outside this shared object.

This means that other components can reference the symbols, and the symbol definitions can be overridden (preempted) by a definition of the same name in another component.

hidden

Sets visibility to hidden. The symbol is not visible outside this shared object.

This means that other components cannot directly reference the symbol.

internal

This is the same as specifying hidden.

protected

Sets visibility to protected. The symbol is seen by the dynamic linker but always dynamically resolves to an object within this shared object.

This means that other components can reference the symbol, but it cannot be overridden by a definition of the same name in another component.

This value is not supported on all targets.

Default

-fvisibility=default

The compiler sets visibility of symbols to default.

Description

This option specifies the default visibility for global symbols (syntax -fvisibility=arg) or the visibility for symbols in declarations, functions, or variables.

The following table shows supported -fvisibility options:

Option

Description

-fvisibility=arg

Sets visibility of symbols for all global declarations.

As specified above in Arguments, arg can be one of the following: hidden internal default protected.

-fvisibility-global-new-delete-hidden

Sets hidden visibility for global C++ operator new and delete declarations.

-fvisibility-inlines-hidden

Sets hidden visibility by default for inline C++ member functions.

-fvisibility-inlines-hidden-static-local-var
-fno-visibility-inlines-hidden-static-local-var

When -fvisibility-inlines-hidden is enabled, static variables in inline C++ member functions will also be given hidden visibility by default.

To disable option -fvisibility-inlines-hidden-static-local-var, specify option -fno-visibility-inlines-hidden-static-local-var.

-fvisibility-ms-compat

Sets default visibility for global types and sets hidden visibility for global functions and variables.

If an -fvisibility option is specified more than once on the command line, the last specification takes precedence over any others.

The following shows the precedence of the visibility settings (from greatest to least visibility):

  • default

  • protected

  • hidden

NOTE:

Clang fvisibility options are also supported. For more information on these options, see the Clang documentation.

IDE Equivalent

None

Alternate Options

None