我正在处理一个 CPP 项目。该项目需要迁移到 64 位系统。它包含了一些内联汇编代码,这些代码无法在 x64 上编译。
以下是包含汇编代码的函数:
void ExternalFunctionCall::callFunction(ArgType resultType, void* resultBuffer)
{
#if defined(_NT_) || defined(__OS2__)
// I386
// just copy the args buffer to the stack (it's already layed out correctly)
int* begin = m_argsBegin;
int* ptr = m_argsEnd;
int arr[1000], i=0;
while (ptr > begin) {
int val = *(--ptr);
__asm push val
}
void* functionAddress = m_functionAddress;
// call the function & handle the return value. use __stdcall calling convention
switch (resultType) {
case voidType:
__asm {
call functionAddress
}
break;
case pointerType:
case int32Type:
__asm {
call functionAddress
mov ebx, resultBuffer
mov dword ptr [ebx],eax
}
break;
case floatType:
__asm {
call functionAddress
mov ebx, resultBuffer
fstp dword ptr [ebx]
}
break;
case doubleType:
__asm {
call functionAddress
mov ebx, resultBuffer
fstp qword ptr [ebx]
}
break;
}
我尝试使用堆栈和数组来迁移这个"asm push val",但是没有成功。虽然没有出现编译错误,但逻辑没有起作用。
因此,我想问,在C++中可以使用什么代替"__asm push val"。任何帮助都将不胜感激。
m_functionAddress
调用的函数? - StoryTeller - Unslander Monica