You're probably using an older version of MinGW. Up until 4.7.0 (I think), MinGW passed the this
pointer on the stack which is different than MSVC's thiscall
convention of passing the this
pointer in ecx
.
Starting with 4.7.0, MinGW uses the same thiscall
calling convention as MSVC.
I can also get the example TesterImp::test()
function to be called from MSVC successfully by marking both Tester::test()
and TesterImp::test()
in test.cpp
with the __attribute__((thiscall))
attribute. This worked with MinGW 4.6.2, which would cause a crash without the attribute being used.