First the calling conversion. The so called __thiscall conversion on
VC++ passes arguments on stack, while this pointer is passed
into ECX register. For GCC, as far as I am aware, the this pointer is
pushed as if it were a special (first) argument. The fix would
be preaty simple but we want the bytecode to be OS independant, so we
cannot change the bytecode.
You're right. There are two flavours of thiscall CC: one using in MS
VCPP, another one used by GCC.
1. Visual C++
pointer to this is passed in the ECX register, callee clears the stack,
so mirroring stdcall CC. If function is varargs the caller calls the
stack, mirroring cdecl CC.
Everything is much clearer Just standard cdecl CC with one hidden
argument (the same as struct return on Darwin).
The other thing are the return types. I don't know (it is probably even
not documented) how VC++ returns smart pointer (boost::smart_ptr),
I think it's the same as struct return. Some investigation will be
or any other type (other basics types, such as int, float, ... are
probably returned into EAX as with GCC).
They're definitely returned via EAX.