The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: johndoe on April 26, 2011, 02:40:41 PM

Title: difrence between ADDR and offset?
Post by: johndoe on April 26, 2011, 02:40:41 PM
like this


invoke MessageBox, NULL, ADDR text, ADDR capt, MB_OK

but this also works

invoke MessageBox, NULL, offset [text], offset [capt], MB_OK

Title: Re: difrence between ADDR and offset?
Post by: jj2007 on April 26, 2011, 02:54:48 PM
Quote from: johndoe on April 26, 2011, 02:40:41 PM
like this


invoke MessageBox, NULL, ADDR text, ADDR capt, MB_OK

but this also works

invoke MessageBox, NULL, offset [text], offset [capt], MB_OK



Same for
invoke MessageBox, NULL, offset text, offset capt, MB_OK

You can use addr and offset for global variables. They produce exactly the same code for global variables in the .data or .data? section.

You can use only addr for local variables. It will produce the following code:
  lea eax, MyLocalVar
  push eax