I could have sworn that I've done this many time before, but now I'm getting a build error for some reason on the code below. I need to reference a structure, pointed to by r8, inside a macro. So I create a local variable .wef inside a "virtual at r8" construct. I declare .wef as local because I want to be able to use this macro more than once in a procedure and not get an error saying ".wef is already defined", and I also don't want to interfere with any .wef variable that might already be defined inside a procedure where this macro is used. My understanding is that .wef will be replaced with a unique symbol each place it appears in the macro.
struc TESTWEF
{
.a rd 1
.b rd 1
.c rq 1
}
macro TEST
{
local .wef
virtual at r8
.wef TESTWEF
end virtual
mov eax, [.wef.a]
mov edx, [.wef.b]
mov rcx, [.wef.c]
}
proc myTest
TEST
ret
endp
But I'm getting the following error:
flat assembler version 1.73.30 (16384 kilobytes memory, x64)
heap.asm [28]:
TEST
heap.asm [21] TEST [7]:
mov eax, [.wef.a]
processed: mov eax,[.wef.a]
error: undefined symbol 'myTest.wef.a'.
It's as though it's replacing the .wef in the "virtual at r8" construct, but not lower down where the structure fields are being accessed. It builds fine if I remove the "local .wef" line, but then I can't use the macro in a procedure twice or in a procedure where there's already a .wef label.