我有一个对象的成员定义为:
struct statebuf
{
void* sp;
void* label;
};
在我的asm代码中我这样做:
#define restorestate(SSB)
__asm mov ebx, this
__asm mov esp, [ebx]SSB.sp
__asm jmp [ebx]SSB.label
#endif
我像使用函数一样使用宏。在"mov ebx, this"之后,我需要为ebx添加偏移量以击中正确的成员。我如何取得SSB的补偿?
解决方案是:
#define restorestate(SSB)
__asm mov ebx, this
__asm add ebx, [SSB]
__asm mov esp, [ebx]SSB.sp
__asm jmp [ebx]SSB.label
#endif
这是我反复试验得出的