When I create my own structures, ADDR in the invoke does not work unless I do the following:

_Foo struct
TempVar DWORD ?
_Foo ends

.data
Foo _Foo <>

If I don't initialize the struct w/ a data segment entry ADDR will not work, but I don't see these steps performed in MASM32 includes but the invoke ADDR does work.

Please explain
Posted on 2002-02-13 13:35:54 by moojit
Hi.
The reason is when you declare a structure such as

_Foo struct
TempVar DWORD ?
_Foo ends

the only thing your really doing is creating a "template" so masm knows how to work with a chunk of memory that is that type.
This does not allocate any storage for the structure. So
when you try to do addr _F00 with out creating a variable
nothing exists to take the address of.

When you declare a variable of type _Foo only then
are you allocating the storage for that variable that looks like
that structure. Hope this helps and hope i explained this well
enough.

take care
prs
Posted on 2002-02-13 14:44:25 by prs
Creating a STRUCT is just like a blueprint. Your saying this is what a ball would look like if I had one. The .DATA or .DATA? statement actually is the ball. You can't bounce the blueprint - you need a real ball. ;)
Posted on 2002-02-13 14:58:41 by bitRAKE