'ATL/COM'에 해당되는 글 1건

  1. 2009.08.09 [COM/C++] offsetofclass 매크로

[COM/C++] offsetofclass 매크로

CS/COM 2009. 8. 9. 22:41

ATL 소스 분석중 나온 매크로로 COM_INTERFACE_ENTRY에 사용된다.
#define offsetofclass(base, derived) \
((DWORD_PTR)(static_cast<base*>((derived*)_ATL_PACKING))  -  _ATL_PACKING))
베이스 클래스의 오프셋을 구하는 매크로다...

별거 아닌데.. DWORD_PTR을 unsigned long* 로 해석해서 완전 해맸다... 히밤




: