You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IID_PPV_ARGS elaboration (1-1-2) and 1 other thing (#113)
* explain IID_PPV_ARGS
add clarity to description
clear up that uuidof returns REFIID and why
* update explanation to be more in depth
adjusted to follow the request of Alex:
talk more about what a GUID and UUID is earlier in the explanation, and include a more accurate explanation of what IID_PPV_ARGS does without bloat after the fact since I explain earlier the whole GUID<->UUID<->why-it-matters-paradigm
* implement changes requested
* The removal of Helper explanation and grammar
Copy file name to clipboardExpand all lines: docs/1-introduction/1-1-getting-started/1-1-2-hello-d3d11.md
+24-2Lines changed: 24 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -142,7 +142,7 @@ We need to include the following headers, here's what each of these headers incl
142
142
#pragma comment(lib, "dxguid.lib")
143
143
```
144
144
145
-
Of course just including the headers isn't enough, we must also link against D3D11 & friends to be able to actually use the stuff declared in the headers, put these `#pragma` in `HelloD3D11.cpp` right below the includes.
145
+
Of course just including the headers isn't enough, we must also link against D3D11 & friends to be able to actually use the stuff declared in the headers, put these `#pragma comment(lib, "PATH_TO_LIB")` in `HelloD3D11.cpp` right below the includes to link these libraries.
146
146
147
147
```cpp
148
148
template <typename T>
@@ -192,7 +192,29 @@ if (FAILED(CreateDXGIFactory2(
192
192
193
193
The first part calls the parent class, where `GLFW` is initialized and setup.
194
194
195
-
!!! error "What is `IID_PPV_ARGS`"?
195
+
`IID_PPV_ARGS(ppType)` Is a compile time macro that is defined as
Which means that typing `IID_PPV_ARGS(&_dxgiFactory)` it is expanded by the compiler into `__uuidof(**(&_dxgiFactory)), IID_PPV_ARGS_Helper(_dxgiFactory)`. This functionally means that for functions that have a parameter setup as `REFIID` and functionally after a `[out] void**` parameter, this macro will expand the `IID_PPV_ARGS(ppType)` expression into these parameters for ease of use — this can be seen with the used `CreateDXGIFactory2` method where the second last and last parameter are a `REFIID` and `void**`:
200
+
```cpp
201
+
HRESULT CreateDXGIFactory2(
202
+
UINT Flags,
203
+
REFIID riid,
204
+
[out] void **ppFactory
205
+
);
206
+
```
207
+
`REFIID` is a typedef that is a Reference (REF) to an Interface Identifier type (`IID`) — this means that it is a reference to a type that uniquely identifies a [COM](link-to-com-subsystem-in-msdn) object.
208
+
[more information like underlying memory organization can be read about IID's at https://docs.microsoft.com/en-us/office/client-developer/outlook/mapi/iid]
209
+
210
+
211
+
What the parts of the `IID_PPV_ARGS(ppType)` macro are:
212
+
213
+
[the `ppType` in `IID_PPV_ARGS(ppType)`]
214
+
- a pointer to a pointer of a object.
215
+
216
+
[the `__uuidof(**(ppType))` part of `IID_PPV_ARGS(ppType)`]
217
+
- at compile time retrieves a `UUID` from `ppType` type which represents a `GUID`, which is returned as a `REFIID` — which means that the type returned is a reference to an identifier to a specific type of COM object.
0 commit comments