On 4/7/11 3:28 PM, Michael Stefaniuc wrote:
On 04/07/2011 07:04 PM, Dylan Smith wrote:
On Thu, Apr 7, 2011 at 1:00 PM, Dylan Smithdylan.ah.smith@gmail.com wrote:
The rest of the richedit code needs to call the ITextHost interface using the thiscall calling convention, so on i386 it calls a thunk in itextHostStdcallVtbl which are defined using the stdcall calling convention, and perform stdcall->thiscall conversion before jumping to the thiscall defined method (i.e. the actual method for user provided ITextHost, and a thunk to reverse the calling convention in Wine).
Sorry, that last part should read (i.e. the actual method for user provided ITextHost, OR a thunk to reverse the calling convention for calling the internal ITextHostImpl).
Thanks for the explanation. It kinda makes sense but it still feels ugly.
I don't know if this will help but...
Both Clang and (recent) GCC have direct support for __attribute__((thiscall)) (and I would know about Clang, I added it to the LLVM side). We could potentially take advantage of this and not have to declare thunks like this.
Chip