help-gplusplus
[Top][All Lists]
Advanced

[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: 27 Sep 2006 09:17:30 -0700
User-agent: G2/1.0

In follow-up, I found the solution to the "this pointer" on the stack
(g++) vs ESI (MSVC) problem.  I was thinking the g++ needed to be
"fixed" but I found that it was MSVC that needed to be "fixed".  The
fix was to change the calling conventino to __stdcall for MSVC as shown
below.  I"m now calling methods between g++ and MSVC without issues.

class ITest
{
public:
        void virtual __stdcall TestFunc(int x, int y, int z) = 0;
};

class Test : ITest
{
public:
        Test() {}
        ~Test() {}

        void __stdcall TestFunc(int x, int y, int z)
        {
                int a; 
                a = x + y + z; 
        } 
};



reply via email to

[Prev in Thread] Current Thread [Next in Thread]