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?
Posted on 2002-10-24 15:56:22 by david
If I am not mistaken, MASM will automatically merge like sections.

So in your inc files just declare them as:
handle1 dd 0
handle2 dd 0
handle3 dd 0
handle4 dd 0

Posted on 2002-10-24 16:06:51 by Graebel
Yea, that is correct. If you have .data with some variables in different files, masm will put them together in .data section.
Posted on 2002-10-24 16:10:35 by Asm_Freak
That's great! I never thought it so easy!
Thanks for the fast replies!
:alright: :) :) :)
Posted on 2002-10-24 16:22:34 by david