Specifying Symbol Visibility Explicitly (Linux*)

This topic applies to C/C++ applications for Linux* only.

You can explicitly set the visibility of an individual symbol using the visibility attribute on a data or function declaration. For example:

int i __attribute__ ((visibility("default"))); 
void __attribute__ ((visibility("hidden"))) x () {...} 
extern void y() __attribute__ ((visibility("protected")));

The visibility declaration attribute accepts one of the five keywords:

The value of the visibility declaration attribute overrides the default set by the options -fpic or -fno-common .