flat assembler
Message board for the users of flat assembler.
Index
> Main > static variables |
Author |
|
revolution 12 Nov 2008, 11:01
Static (global) variables are best placed in one of your data sections.
Proc local variables are on the stack so they can't be static. |
|||
12 Nov 2008, 11:01 |
|
sleepsleep 12 Nov 2008, 20:18
i don't know whether if you has the option to create a new section with readable but no writeable option.
something like. section '.data2' data2 readable but nothing is impossible in programming right... |
|||
12 Nov 2008, 20:18 |
|
windwakr 12 Nov 2008, 21:00
I believe the correct name for a readable only data section is '.rdata'
section '.rdata' data readable Here is a simple example: Code: format PE GUI 4.0 entry start include 'win32a.inc' section '.data' data readable writeable buf rb 256 section '.rdata' data readable number dd 2 fmt db '%u',0 title db '...',0 section '.code' code readable executable start: cinvoke wsprintf,buf,fmt,[number] invoke MessageBox,NULL,buf,title,MB_OK invoke ExitProcess,0 section '.idata' import data readable writeable library kernel32,'KERNEL32.DLL',\ user32,'USER32.DLL' include 'api/kernel32.inc' include 'api/user32.inc' |
|||
12 Nov 2008, 21:00 |
|
revolution 19 Nov 2008, 14:10
windwakr wrote: I believe the correct name for a readable only data section is '.rdata' |
|||
19 Nov 2008, 14:10 |
|
bitRAKE 19 Nov 2008, 17:01
They can even be blank - OS doesn't use them.
|
|||
19 Nov 2008, 17:01 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.