//Pascal 嵌入汇编,在Delphi下编译通过
function AttachStart:DWORD;stdcall;
asm
CALL @@1
@@1:
POP EAX
SUB EAX, 5
end;
//对应的C格式嵌入汇编,编译时提示@@1未定义
DWORD __stdcall AttachStart()
{
DWORD RS;
asm{
CALL @@1 //编译时提示@@1未定义
@@1:
POP EAX
SUB EAX , 5
MOV RS , EAX
}
return RS;
}
请问这样转换对吗? 如何解决?
//------------------------------------------------------------------------------
------解决方案--------------------------------------------------------
换一个标号名称试试,比如 lab0
------解决方案--------------------------------------------------------
这样试试:
DWORD __stdcall AttachStart()
{
DWORD RS;
asm{
CALL lbl1;
}
lbl1:
asm{
POP EAX ;
SUB EAX , 5;
MOV RS , EAX;
}
return RS;
}
------解决方案--------------------------------------------------------
#pragma inline
或加入编译指令 -B