Inline assembler getaddress of pointer Visual Studio
- by Joe
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?
}