News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

difrence between ADDR and offset?

Started by johndoe, April 26, 2011, 02:40:41 PM

Previous topic - Next topic

johndoe

like this


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

but this also works

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


jj2007

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