Can someone explain to me what a Thunk is?
and an ATL Thunk?
I know a thunk has something to do with the vtbl and execution of code to find the right function pointer. Am I right?
Can someone explain to me what a Thunk is?
and an ATL Thunk?
I know a thunk has something to do with the vtbl and execution of code to find the right function pointer. Am I right?
It is a generic term for a piece of adapter code that fundamentally changes the execution environment. I saw it first being used during the 16-bit to 32-bit Windows transition, a thunk was used to allow code that was running in 16-bit mode to call 32-bit code.
Something similar for ATL thunks. It knows how to turn a Windows callback, a pure C execution environment with nothing but a window handle to distinguish the context, into a virtual method call on a class object. The thunk takes care of mapping the window handle to the ATL class instance that wraps it, and translate the message number to the corresponding virtual method.
© 2022 - 2024 — McMap. All rights reserved.