How to mov EAX, &func?

Walter Bright newshound2 at digitalmars.com
Wed May 16 00:05:03 PDT 2012


On 5/15/2012 12:33 PM, Mehrdad wrote:
> How do get the address of a function in naked assembly code?
>
> void foo()
> {
> asm
> {
> naked;
> mov EAX, &foo;
> }
> }
>
> This doesn't work...

I know, but also be aware that even if it did work, it would not work in the 
presence of PIC code and shared libraries. It's best if you stick to using D 
code to get the address of a function, which accounts for all these variations 
and wierdness.


More information about the Digitalmars-d mailing list