Skip to content

Commit 01ac437

Browse files
naughtont3jsquyres
andcommitted
add text on symbol visibility
Signed-off-by: Thomas Naughton <naughtont@ornl.gov> Co-authored-by: Jeff Squyres <jsquyres@users.noreply.github.com>
1 parent 50856c2 commit 01ac437

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

docs/developers/source-code.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,3 +263,30 @@ of the |ompi_series| source tree):
263263
264264
Under these mandated directories, frameworks and/or components may have
265265
arbitrary directory structures, however.
266+
267+
Symbol Visibility
268+
-----------------
269+
270+
The ``*_DECLSPEC`` macros provide a method to annotate symbols to indicate
271+
their intended visibility when compiling dynamically shared object files
272+
(e.g., ``libmpi.so``). The macros are defined on a per project basis:
273+
274+
* Open MPI: ``OMPI_DECLSPEC``
275+
* Open PAL: ``OPAL_DECLSPEC``
276+
* OpenSHMEM: ``OSHMEM_DECLSPEC``
277+
278+
The macros expand to the appropriate compiler and platform flags for marking
279+
whether a symbol should be explicitly made public in the target project's
280+
library namespace.
281+
The ``*_DECLSPEC`` attributes are used to declare that a symbol is to be
282+
visible outside of that library/DSO's scope. For example, ``OMPI_DECLSPEC``
283+
is used to control what symbols are visible in the ``libmpi.so`` scope.
284+
285+
.. note:: This is entirely related to dynamic library compilation and does not
286+
apply to static compilation.
287+
288+
.. note:: The macros were originally introduced when Open MPI supported
289+
Windows (circa Open MPI v1.0.0) and are motivated by the Windows
290+
`__declspec <https://docs.microsoft.com/en-us/cpp/cpp/declspec?view=msvc-170>`_.
291+
While support for Windows has been dropped from Open MPI, the symbol
292+
visibility macros remain.

0 commit comments

Comments
 (0)