I have a code like:

.code
start:
Invoke apicall, addr foo1
[...]
Invoke ExitProcess, 0

foo1 db "example"

End start

When I compile the program, ML says: undefined simbol foo1
I think that the problems is the number of passes that ML makes to the .asm or something like that. There is any parameter to ML.EXE or what I can do (I must use the .code segment)?
Posted on 2002-09-29 08:01:53 by wildark
if you use invoke you must take variabel at .data section
or you can use lea eax, foo1
Posted on 2002-09-29 08:16:30 by irwan
I know that I would must define foo1 in the .data section but this is an especial case...
Posted on 2002-09-29 08:20:47 by wildark


.code

foo1 db "example"

start:
Invoke apicall, addr foo1
[...]
Invoke ExitProcess, 0

End start


or



.code
start:
jmp @F
foo1 db "example"
@@:
Invoke apicall, addr foo1
[...]
Invoke ExitProcess, 0

End start
Posted on 2002-09-29 08:27:28 by Qweerdy
use :
lea eax, foo1
push eax
call apicall
Posted on 2002-09-29 08:29:30 by irwan
Thanks, irwan. I didn't know that trick yet :grin:
Posted on 2002-09-29 09:27:18 by Qweerdy
invoke apicall,addr foo1

actually resolves to:

lea eax,foo1
push eax
call apicall

as far as i can tell neither addr nor offset work with forward referencing when used with invoke.

however offset can work with forward referencing when used with simple opcodes so:

push offset foo1
call apicall
Posted on 2002-09-29 13:00:42 by MArtial_Code
This is the MASM way:
	EXTERNDEF foo1:BYTE


Invoke apicall, addr foo1

Invoke ExitProcess, 0

foo1 db "example"
...just tell the assembler what foo1 is.
Posted on 2002-09-29 13:41:43 by bitRAKE