c++ gcc inline assembly does not seem to work
问题 I am trying to figure out gcc inline assembly on c++. The following code works on visual c++ without % and other operands but i could not make it work with gcc void function(const char* text) { DWORD addr = (DWORD)text; DWORD fncAddr = 0x004169E0; asm( "push %0" "\n" "call %1" "\n" "add esp, 04" "\n" : "=r" (addr) : "d" (fncAddr) ); } I am injecting a dll to a process on runtime and fncAddr is an address of a function. It never changes. As I said it works with Visual C++ VC++ equivalent of