Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error C2400: inline assembler syntax error in 'second operand'; found 'register'

I am facing compilation error while working with assembly instructions in VC++ as MACRO inline based assembler blocks.

error C2400: inline assembler syntax error in 'second operand'; found 'register'

Here is the code:

_asm {\

        mov esi,dword ptr [pMemBlock]\
        sub esp,sizeOfblock\
        mov ebx,sizeOfblock\
        mov shrResult,ebx\
        shr shrResult,2\
        mov ecx,shrResult\
        mov shrResult,0\
        mov edi,esp\
        rep movs dword ptr es:[edi],dword ptr[esi]\
}

Regards Usman

like image 509
Usman Avatar asked Dec 06 '25 23:12

Usman


2 Answers

That blank line after the _asm { line will complete the macro. It should be deleted or have \ on it.

like image 137
GManNickG Avatar answered Dec 08 '25 12:12

GManNickG


It should be

_asm {\
    __asm mov esi,dword ptr [pMemBlock]\
    __asm sub esp,sizeOfblock\
    ...

See this msdn page.

like image 43
Abyx Avatar answered Dec 08 '25 11:12

Abyx



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!