-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
41 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,45 @@ | ||
\Ch{Declarations}{Decl} | ||
\Sec{Function Definitions}{Decl.Function} | ||
\Sub{Visibility and Linkage}{Decl.Function.Visibility} | ||
|
||
\p Functions have \textit{internal linkage} by default. | ||
|
||
\Sec{Attributes}{Decl.Attr} | ||
\Sub{Entry Attributes}{Decl.Attr.Entry} | ||
\Sec{Linkage}{Decl.Linkage} | ||
|
||
\p An entity that denotes an object, reference, function, type, template, namespace, or value, may have a \textit{linkage}. If a name has \textit{linkage}, it refers to the same entity as the same name introduced by a declaration in another scope. If a variable, function, or another entity with the same name is declared in several scopes, but does not have sufficient \textit{linkage}, then several instances of the entity are generated. | ||
|
||
\p There are three linkages recognized: \textit{external linkage}, \textit{internal linkage} and \textit{no linkage}. | ||
|
||
\Sub{External Linkage}{Decl.Linkage.External} | ||
|
||
\p Entities with \textit{external linkage} can be referred to from the scopes in the other translation units and enable linking between them. | ||
|
||
\p The following entities in HLSL have \textit{external linkage}: | ||
\begin{itemize} | ||
\item entry point functions | ||
\item functions marked with \texttt{export} keyword | ||
\item global variables that are not marked \texttt{static} or \texttt{groupshared} \footnote{These are not really linked with other translation units but rather their values are loaded indirectly based on cbuffer mapping.} | ||
\item enumerations | ||
\item classes, their member functions, static data members, nested classes and enumerations | ||
\item template classes not declared \texttt{static} | ||
\end{itemize} | ||
|
||
\p Linkage of functions (including template functions) that are not entry points or marked with \texttt{export} keyword is implementation dependent. \footnote{In DXC today functions that are not entry points or exported have \textit{internal linkage} by default. This can be overriden by \texttt{-default-linkage} compiler option.} | ||
|
||
\Sub{Internal Linkage}{Decl.Linkage.Internal} | ||
|
||
\p Entities with \textit{internal linkage} can be referred to from all scopes in the current translation unit. | ||
|
||
\p The following entities in HLSL have \textit{internal linkage}: | ||
\begin{itemize} | ||
\item global variables marked as \texttt{static} or \texttt{groupshared} | ||
\end{itemize} | ||
|
||
\Sub{No Linkage}{Decl.Linkage.NoLinkage} | ||
|
||
\p An entity with \textit{no linkage} can be referred to only from the scope it is in. | ||
|
||
\p Any of the following entites declared at block scope have no linkage: | ||
\begin{itemize} | ||
\item local variables | ||
\item local classes and their member functions | ||
\item other names declared at block scope such as typedefs, enumerations, and enumerators. | ||
\end{itemize} |