• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2018 Andrey Semashev
2# Distributed under the Boost Software License, Version 1.0.
3# (See accompanying file LICENSE_1_0.txt or copy at
4# http://www.boost.org/LICENSE_1_0.txt)
5
6import feature ;
7
8#| tag::doc[]
9
10[[bbv2.builtin.features.visibility]]`visibility`::
11*Allowed values:* `global`, `protected`, `hidden`.
12+
13Specifies the default symbol visibility in compiled binaries. Not all values
14are supported on all platforms and on some platforms (for example, Windows)
15symbol visibility is not supported at all.
16+
17The supported values have the following meaning:
18+
19`global`::: a.k.a. "default" in gcc documentation. Global symbols are
20  considered public, they are exported from shared libraries and can be
21  redefined by another shared library or executable.
22`protected`::: a.k.a. "symbolic". Protected symbols are exported from shared
23  ibraries but cannot be redefined by another shared library or executable.
24  This mode is not supported on some platforms, for example OS X.
25`hidden`::: Hidden symbols are not exported from shared libraries and cannot
26  be redefined by a different shared library or executable loaded in a process.
27  In this mode, public symbols have to be explicitly marked in the source code
28  to be exported from shared libraries. This is the recommended mode.
29+
30By default compiler default visibility mode is used (no compiler flags are
31added).
32+
33NOTE: In Boost super-project Jamroot file this property is set to the default
34value of `hidden`. This means that Boost libraries are built with hidden
35visibility by default, unless the user overrides it with a different
36`visibility` or a library sets a different `local-visibility` (see below).
37
38|# # end::doc[]
39
40feature.feature visibility
41    : global protected hidden
42    : optional composite propagated ;
43
44feature.compose <visibility>global : <local-visibility>global ;
45feature.compose <visibility>protected : <local-visibility>protected ;
46feature.compose <visibility>hidden : <local-visibility>hidden ;
47