How to mov EAX, &func?

Alex Rønne Petersen alex at lycus.org
Tue May 15 13:58:51 PDT 2012


On 15-05-2012 22:51, Gor Gyolchanyan wrote:
> I think I had that one before. Try this one:
> void foo()
> {
>      void* foopt = cast(void*)&foo;
>      asm
>      {
>          naked;
>          mov EAX fooptr;
>      }
> }
>
> On Tue, May 15, 2012 at 11:33 PM, Mehrdad <wfunction at hotmail.com
> <mailto:wfunction at hotmail.com>> wrote:
>
>     How do get the address of a function in naked assembly code?
>
>     void foo()
>     {
>             asm
>             {
>                     naked;
>                     mov EAX, &foo;
>             }
>     }
>
>     This doesn't work...
>
>
>
>
> --
> Bye,
> Gor Gyolchanyan.

That's not naked inline asm, though.

Something like this might work:

void foo()
{
	asm
	{
		naked;
		mox EAX, dword ptr foo;
		/* whatever... */
	}
}

-- 
Alex Rønne Petersen
alex at lycus.org
http://lycus.org


More information about the Digitalmars-d mailing list