can you declare a structure as a field inside your structure in yasm/nasm? I tried to get it to work and it keeps giving me an error message
struct FRED
asdf: resd 1
endstruc
struct MYOTHERSTRUC
fredStruc: FRED
endstruc
In original nasm you cannot, but you can do a trick:
struct FRED
.asdf resd 1
endstruc
struct MYOTHERSTRUC
.fredStruc.asdf resd 1 ; inline FRED
.rcDraw.left resd 1 ; inline RECT
.rcDraw.top resd 1
.rcDraw.right resd 1
.rcDraw.bottom resd 1
endstruc
Or, if you do not need to access FRED members - define it as space:
struct MYOTHERSTRUC
.fredStruc resb sizeof(FRED)
endstruc
where sizeof is defined as
%define sizeof(x) x %+ _size
just copy all FRED members and append "fredStruc." prefix to all. It could be done by extra macro that wraps the 'struct' macro, i didn't tried.