Hi, I would like to know if I can insert variables into the .data section from the .code section.
I got many include files and I would like to have the variables they use in .data section declared in respective include files...
Like if I had the include file, 'DlgProc2.inc' and it has some variables like handle1, handle2 etc, I would like to somehow, in DlgProc2.inc:
-- ----------DlgProc2.inc starts------------------------------
handle1 dd 0 ; these four handles I want in data section, but want them declared here for easy reading of code
handle2 dd 0 ; so I don't have to switch between the different sourcefiles, is it possible?
handle3 dd 0
handle4 dd 0
DlgProc2 proc USES EBX ESI EDI hDlg:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
etc etc....
How do I solve this?
I got many include files and I would like to have the variables they use in .data section declared in respective include files...
Like if I had the include file, 'DlgProc2.inc' and it has some variables like handle1, handle2 etc, I would like to somehow, in DlgProc2.inc:
-- ----------DlgProc2.inc starts------------------------------
handle1 dd 0 ; these four handles I want in data section, but want them declared here for easy reading of code
handle2 dd 0 ; so I don't have to switch between the different sourcefiles, is it possible?
handle3 dd 0
handle4 dd 0
DlgProc2 proc USES EBX ESI EDI hDlg:DWORD, uMsg:DWORD, wParam:DWORD, lParam:DWORD
etc etc....
How do I solve this?
If I am not mistaken, MASM will automatically merge like sections.
So in your inc files just declare them as:
.data
handle1 dd 0
handle2 dd 0
handle3 dd 0
handle4 dd 0
.code
....
So in your inc files just declare them as:
.data
handle1 dd 0
handle2 dd 0
handle3 dd 0
handle4 dd 0
.code
....
Yea, that is correct. If you have .data with some variables in different files, masm will put them together in .data section.
That's great! I never thought it so easy!
Thanks for the fast replies!
:alright: :) :) :)
Thanks for the fast replies!
:alright: :) :) :)