[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: What should the call stack look like when calling a C++ virtual func
From: |
Dev1024 |
Subject: |
Re: What should the call stack look like when calling a C++ virtual function? |
Date: |
25 Sep 2006 12:10:23 -0700 |
User-agent: |
G2/1.0 |
I'm looking at XPCOM now. If I can validate that it works with both
compilers, I'll submit a follow-up post here.
Thanks!
Dev1024
PS. For anyone who reads this at a later time, back to my original
submission, I did find that the MSVC compiler is also passing in the
"this" pointer as well. Note, however, that it doesn't pass it in on
the stack as g++ does. Instead it loads it into ECX. See:
testptr->TestFunc(1, 2, 3);
0040102B mov eax,dword ptr [esi] //load EAX with the address
of the function
0040102D push 3 //load params onto
the stack
0040102F push 2
00401031 push 1
00401033 mov ecx,esi //HERE IT IS. Load
"this" pointer into ECX
00401035 call dword ptr [eax] //call the method
A good tutorial on the way MSVC does virtual functions is provided
here:
http://msdn.microsoft.com/msdnmag/issues/0300/c/
- What should the call stack look like when calling a C++ virtual function?, Dev1024, 2006/09/23
- Re: What should the call stack look like when calling a C++ virtual function?, Paul Pluzhnikov, 2006/09/23
- Re: What should the call stack look like when calling a C++ virtual function?, Dev1024, 2006/09/24
- Re: What should the call stack look like when calling a C++ virtual function?, Paul Pluzhnikov, 2006/09/25
- Re: What should the call stack look like when calling a C++ virtual function?, Dev1024, 2006/09/25
- Re: What should the call stack look like when calling a C++ virtual function?, Paul Pluzhnikov, 2006/09/25
- Re: What should the call stack look like when calling a C++ virtual function?,
Dev1024 <=
- Re: What should the call stack look like when calling a C++ virtual function?, Dev1024, 2006/09/25
- Re: What should the call stack look like when calling a C++ virtual function?, Dev1024, 2006/09/27
- Re: What should the call stack look like when calling a C++ virtual function?, Paul Pluzhnikov, 2006/09/28