flat assembler
Message board for the users of flat assembler.
Index
> Windows > invoke [local variable] compile error |
Author |
|
LocoDelAssembly 12 Apr 2010, 21:54
Is "filesizeh" also local? In that case use "addr filesizeh" instead.
[edit]This works: Code: include 'win32axp.inc' proc main locals hfile rd 1 filesizeh rd 1 endl invoke GetFileSize, [hfile], addr filesizeh ret endp .end main |
|||
12 Apr 2010, 21:54 |
|
mindcooler 12 Apr 2010, 23:46
Yes, that makes it work. Remind me, why is addr needed here? Now that you mention it I have seen similar threads around here. Is it needed to explicitly produce lea instructions?
|
|||
12 Apr 2010, 23:46 |
|
LocoDelAssembly 13 Apr 2010, 00:24
Because if you don't use addr you'll get "push ebp+offset", and the processor does not support that. With global vars this problem does not occur because the address ends up being a single number so the "push imm32" instruction can be used there.
And yes, "addr" (which use "lea edx, [argument] / push edx") has to be explicitly specified (and you also have to be aware that EDX is obviously destroyed in the process so you have to be careful if you use it as an argument). |
|||
13 Apr 2010, 00:24 |
|
bitshifter 13 Apr 2010, 03:07
In short: Local variables are stored on the local stack frame.
|
|||
13 Apr 2010, 03:07 |
|
mindcooler 13 Apr 2010, 08:26
OK, thanks, I can buy that I need to make it explicit because I need to be aware of that edx gets clobbered. The error message was a bit hard to interpret
|
|||
13 Apr 2010, 08:26 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.