Inline assembler getaddress of pointer Visual Studio

Posted by Joe on Stack Overflow See other posts from Stack Overflow or by Joe
Published on 2010-06-03T02:13:03Z Indexed on 2010/06/03 2:14 UTC
Read the original article Hit count: 247

Filed under:
|
|
|
|

I have a function in VS where I pass a pointer to the function. I then want to store the pointer in a register to further manipulate. How do you do that?

I have tried

void f(*p)
{
__asm mov eax, p // try one FAIL
__asm mov eax, [p] // try two FAIL
__asm mov eax, &p // try three FAIL
}

Both 1 and 2 are converted to the same code and load the value pointed to. I just want the address. Oddly, option 1 works just fine with integers.

void f()
{
int i = 5;
__asm mov eax, i // SUCCESS?
}

© Stack Overflow or respective owner

Related posts about assembly

Related posts about inline