News:

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

INVOKE and ADDR directives

Started by guro, April 06, 2011, 11:14:46 AM

Previous topic - Next topic

guro

 Hey Tedd, i didn't scare at all ... it was a pleasure to read all those comments and learn from all! If we would like to add another Murphy's law (if not already exist) that simple questions have complicated answers...but anyway!

Now, I study the various links to documents that our friends provided to their comments in this thread, but to make a premature statement about the ongoing argue, I think we talk about the same thing but from different perspectives (linker abstraction, loader abstraction, in-file offsets, in-memory offsets, assembler abstraction, etc) which is very instructive!

mineiro

Well, I ever believed that offset is a pointer to some place, but things get really strange when you change your way of programming. To me, offset can deal with fowards referenced labels, but today I can't compile a single hello world. :red
Quote
Syntax:   OFFSET expression
The <expression> is any label, variable, segment, or other direct memory operand.
include \masm32\include\masm32rt.inc
.code
start:
lea edx,TheText
invoke MessageBox, 0, edx, edx, MB_OKĀ  ;works ok
push MB_OK ;works ok
push offset TheText
push offset TheText
push 0
call MessageBox
invoke MessageBox, 0, offset TheText, offset TheTitle, MB_OK ;dont work
invoke ExitProcess, 0
TheText:
db "The text", 0
TheTitle:
db "The title", 0
end start

If you put that variables betwen .code and start: , works fine.
The absense of light make me blind, but much light make me blind too.

jj2007

Strangely enough, this works with JWasm, but ml (6.14...9.0) throws indeed error A2006:undefined symbol : TheTitle

Antariy

Quote from: jj2007 on May 18, 2011, 02:38:13 AM
Strangely enough, this works with JWasm, but ml (6.14...9.0) throw indeed error A2006:undefined symbol : TheTitle

Look into MASM's INVOKE as in MACRO of assembler-level. MACROses expanded at first pass, so any symbol should be defined before using of MACRO, in this case - INVOKE.

mineiro

Thanks for answering, now this make sense to me.