зеркало из https://github.com/microsoft/DirectXTK.git
Updated Implementation (markdown)
Родитель
961cd20fb1
Коммит
ade80556b8
|
@ -142,6 +142,10 @@ SpriteBatch::~SpriteBatch() = default;
|
|||
# Calling-conventions
|
||||
Public methods in the library are explicitly marked ``__cdecl`` to ensure consistent behavior no matter what the client code is using. Internally it is not specified as it's assumed from the default setting except where ``XM_VECTORCALL`` is utilized (see the _DirectXMath_ section below). Public ``inline`` functions do not need to be explicitly marked ``__cdecl``.
|
||||
|
||||
> This generally only matters for 32-bit (x86) platforms which have a potential mix of many calling conventions (``__stdcall``, ``__cdecl``, ``__fastcall``, or ``__vectorcall``). For X64, ARM, and ARM64 they all generally just use one calling convention (``__fastcall``). For 64-bit (x64 native), the ``__cdecl`` is interpreted by the compiler as an alias for ``__fastcall`` so it's the same as annotating them with the default calling convention. It's still important to annotate exported public functions for x64 because it's possible to build the client using ``/Gv`` which assumes ``__vectorcall`` if nothing is specified.
|
||||
|
||||
> Note that annotation for the calling-convention only has to be on the function declaration/prototype as the definition will pick it up implicilty.
|
||||
|
||||
The ``std::function`` is used for callbacks as a general pattern so that client code can provide function pointers, lambdas, functors, etc. To support building with a mix of calling conventions, we need to annotate the ``std::function`` correctly.
|
||||
|
||||
```cpp
|
||||
|
|
Загрузка…
Ссылка в новой задаче