So I guess I only play around with this stuff once every couple of years...
I have seen several examples of structures inside of structures. Most of them repeat defining the structure inside. This includes the official example on how to use structures as well as the use inside 'Windows.inc'. Sure I can do that. But is there any reason the following wouldn't work (besides just not working)?
NASMX_STRUC POINT
NASMX_RESERVE x, uint32_t, 1
NASMX_RESERVE y, uint32_t, 1
NASMX_ENDSTRUC
NASMX_STRUC RECT
NASMX_RESERVE TopLeft, POINT, 1
NASMX_RESERVE BottomRight, POINT, 1
NASMX_ENDSTRUC
Reasonings behind this simpler way include being able to change the structure in just one place and update the rest of your sources. Say in building server/client applications.
;// Protocol.inc
...
NASMX_STRUC PROTOCOL
NASMX_RESERVE action, uint32_t, 1
NASMX_RESERVE id, uint32_t, 1
NASMX_ENDSTRUC
...
;// Server.asm
...
%include 'Protocol.inc'
...
NASMX_STRUC Server
NASMX_RESERVE ServerId, uint32_t, 1
NASMX_RESERVE Protocol, PROTOCOL, 1
NASMX_RESERVE reserved1, uint32_t, 1
NASMX_ENDSTRUC
...
;// Client.asm
...
%include 'Protocol.inc'
...
NASMX_STRUC Client
NASMX_RESERVE ClientId, uint32_t, 1
NASMX_RESERVE Protocol, PROTOCOL, 1
NASMX_RESERVE reserved1, uint32_t, 1
NASMX_ENDSTRUC
...
Above you would only have to Change PROTOCOL in Protocol.inc to affect both Server.asm and Client.asm.
At this point, if you wanted to add "NASMX_RESERVE Length, uint32_t, 1" to PROTOCOL, you have to change it 3 different times. Perhaps I just haven't found the easy way of doing this?
EDIT: Or perhaps I've been up too late to ask the real question....
NASMX_STRUC XXXX
NASMX_RESERVE Name, NASMX_TCHAR, 254
NASMX_ENDSTRUC
NASMX_STRUC YYYY
NASMX_RESERVE x, XXXX, 1
NASMX_ENDSTRUC
...
proc SetName, ptrdiff_t y
...
mov __DI, ptrdiff_t [argv(.y)]
add __DI, YYYY.x.Name ;//Error here "symbol 'YYYY.x.Name' undefined"
...
The only fix I've found is to embed NASMX_STRUC x, XXXX inside of YYYY thus making 2 copies of the structure to maintain.