DirectX๋ฅผ ๋ฐฐ์ฐ๊ณ ์์์ต๋๋ค
๊ฐ์ฒด๋ฅผ ์์ฑํ ๋ ์ผ๋ฐ ํฌ์ธํฐ๊ฐ ์๋๋ผ ComPtr์ ์ฌ์ฉํ์์์
๊ทธ๋ฐ๋ฐ ComPtr์๋ ํฌ์ธํฐ์ ์ฃผ์๊ฐ์ ์ป๋ ๋ฐฉ์์ด ๋๊ฐ์ง๋๋ผ๊ณ ์
ํ๋๋ .GetAddressOf() ๋ฅผ ์ฐ๋ ๊ฑฐ๊ณ
ํ๋๋ & ์ฐ์ฐ์๋ฅผ ์ฐ๋ ๊ฑด๋ฐ
์ฑ ์์ ๋ณด๋๊น ์ผ๋ฐ์ ์ผ๋ก๋ ์ฐ์ฐ์๋ฅผ ์ฐ๋ค๊ฐ ์ด๋จ ๋๋ ๋ ํจ์๋ฅผ ์ฐ๋๊ตฐ์... ์ด๋จ ๋ ํจ์๋ฅผ ์ฐ๊ณ ์ด๋จ ๋์ ์ฐ์ฐ์๋ฅผ ์ฌ์ฉํ๋ ๊ฑด๊ฐ์?
๊ฐ์ฒด๋ฅผ ์์ฑํ ๋ ์ผ๋ฐ ํฌ์ธํฐ๊ฐ ์๋๋ผ ComPtr์ ์ฌ์ฉํ์์์
๊ทธ๋ฐ๋ฐ ComPtr์๋ ํฌ์ธํฐ์ ์ฃผ์๊ฐ์ ์ป๋ ๋ฐฉ์์ด ๋๊ฐ์ง๋๋ผ๊ณ ์
ํ๋๋ .GetAddressOf() ๋ฅผ ์ฐ๋ ๊ฑฐ๊ณ
ํ๋๋ & ์ฐ์ฐ์๋ฅผ ์ฐ๋ ๊ฑด๋ฐ
์ฑ ์์ ๋ณด๋๊น ์ผ๋ฐ์ ์ผ๋ก๋ ์ฐ์ฐ์๋ฅผ ์ฐ๋ค๊ฐ ์ด๋จ ๋๋ ๋ ํจ์๋ฅผ ์ฐ๋๊ตฐ์... ์ด๋จ ๋ ํจ์๋ฅผ ์ฐ๊ณ ์ด๋จ ๋์ ์ฐ์ฐ์๋ฅผ ์ฌ์ฉํ๋ ๊ฑด๊ฐ์?
GetAddressOf๋ ํฌ์ธํฐ์ ํฌ์ธํฐ๋ฅผ ๊ฐ์ ธ์ด
๊ทธ๋ฐ๋ฐ getaddressof๋ฅผ ์ฐ๋ ์๋ฆฌ์ &๊ฐ์ฒด ๋ฅผ ์ฐ๋๋ผ๊ณ ์ฌ ใ ใ
์ ๊ธฐ์ต์ด ๋ง๋ค๋ฉด &์ฐ์ฐ์๋ comptr์๋ค๊ฐ ์ฐ๊ธฐ์ฉ์ผ๋ก ์ฌ์ฉํ ๋ ์จ์. ๊ทธ๋์ ๋ฌด์กฐ๊ฑด comptr์ ๋ฌถ์ด๋์ ๊ฐ์ฒด๋ฅผ ๋ฐฉ์ถํ๊ณ ๋ฐ์. GetAddressOf๋ ๋จ์ ์ฝ๊ธฐ์ฉ์ด๊ธฐ๋๋ฌธ์ ๊ฐ์ฒด ๋ฐฉ์ถ ์ํด์ - dc App
์ ๊ทธ๋ ๊ตฐ์... ๊ทธ๋ฌ๋ฉด ๊ฐ์ฒด ์์ฑํ ๋๋ ์ผ๊ด์ฑ์๊ฒ ์ฐ์ฐ์๋ฅผ ์ฐ์ง ์ ์ฑ ์์๋ ์ด๋จ ๋์๋ ํจ์๋ฅผ ์จ์ ํท๊ฐ๋ฆฌ๊ฒ ํ๋.... - dc App
์ด์งํผ &์ฐ์ฐ์๋ GetAddressOf๋ ์ต์ด๋ก ์ธ๋ ๋ฌถ์ธ๊ฒ์์ด์ ์ด๋ป๊ฒ ์ฐ๋ ์๊ด ์๊ธดํ ํ ๋ฐ ์ฒจ ๋ณด๋ ์ ์ฅ์์ ํท๊ฐ๋ฆด๊ฑฐ๊ฐ๊ธดํ๋ค์.. - dc App
๋๋ ๊ถ๊ธํด์ ๊ฒ์ํด๋ด. ์ด๋ฏธ ํด๊ฒฐ ํ๋์ง๋ ๋ชจ๋ฅด๊ฒ ์ง๋ง ๊ทธ๋๋ ๊ธ ๋จ๊ฒจ๋ด. GetAddressOf - Retrieves the address of the ptr_ data member, which contains a pointer to the interface represented by this ComPtr. Operator& - Releases the interface associated with this ComPtr object and then retrieves the address of the ComPtr object.
๊ฐ๊ฐ ์ฌ๊ธฐ์ ํ์ธ ํ ์ ์๊ณ
https://docs.microsoft.com/en-us/previous-versions/br244957(v=vs.140)?redirectedfrom=MSDN
https://docs.microsoft.com/en-us/previous-versions/br230430(v=vs.140)?redirectedfrom=MSDN
This
method differs from ComPtr::GetAddressOf in that this method releases a reference to the interface pointer. Use ComPtr::GetAddressOf when you require the address of the interface pointer but do not want to release
์ด๋ฐ ๋ด์ฉ์ด ์์ ๊ตฌ๊ธ ๋ฒ์ญ๊ธฐ ๋๋ ค๋ณธ ๊ฒฐ๊ณผ ์ด ๋ฉ์๋๋ ์ธํฐํ์ด์ค ํฌ์ธํฐ์ ๋ํ ์ฐธ์กฐ๋ฅผ ํด์ ํ๋ค๋ ์ ์์ ComPtr :: GetAddressOf์ ๋ค๋ฆ ๋๋ค. ์ธํฐํ์ด์ค ํฌ์ธํฐ์ ์ฃผ์๊ฐ ํ์ํ์ง๋ง ํด๋น ์ธํฐํ์ด์ค๋ฅผ ํด์ ํ์ง ์์ผ๋ ค๋ ๊ฒฝ์ฐ ComPtr :: GetAddressOf๋ฅผ ์ฌ์ฉํ์ญ์์ค. ์ ๊ทผ๋ฐ ๋์ ๋๊ธ ๋ฌ๊ธฐ ๊ฐ๋ถํธํ๋ค ์ํฐ๋ง ์ณ๋ ๋ฐ๋ก ๋๊ธ ๋ฑ๋ก๋๋ค;;