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)?
.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)?
if you use invoke you must take variabel at .data section
or you can use lea eax, foo1
or you can use lea eax, foo1
I know that I would must define foo1 in the .data section but this is an especial case...
.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
use :
lea eax, foo1
push eax
call apicall
lea eax, foo1
push eax
call apicall
Thanks, irwan. I didn't know that trick yet :grin:
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
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
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.