flat assembler
Message board for the users of flat assembler.

Index > Windows > Multiple Sections in one EXE? *SOLVED*

Author
Thread Post new topic Reply to topic
calpol2004



Joined: 16 Dec 2004
Posts: 110
calpol2004
EDIT: .data and .code macros instead of defining sections (3.2.2 in documentation).

Ive been on and off working on a little opengl project for a while now, usually when wow servers are down or something :p. And im starting to reach a point where code management is becoming a priority.

The ways i know are to create dynamic link libraries but these don't allow you to share variables easily. To create inc files with procedures them and use local/virtual variables but all global variables all have to be in the main file. Or to have a .data include and a .code include for your procedures and include them in the .code and .data sections of your app.

Im currently using the last method which works, but i really want to not have the data and code in separate files. Ideally i'd just like to define another .code section and have the assembler just append all the .code sections together (same with .data) but that comes up with the error "out of memory".

Any ideas on code management in fasm?
Post 26 Oct 2008, 17:05
View user's profile Send private message MSN Messenger Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 764
Location: Massachusetts, USA
bitshifter
These macro's are defined in WIN32AX.INC and as far as i can tell, they are only to provide an easy way to declare a section.
Code:
macro .data { section '.data' data readable writeable }
macro .code { section '.text' code readable executable }    

I looks like multilple sections of the same type can be defined, but i dont think that fasm will group them together (like a linker does) so your file size will probably increase due to each sections alignment width.
If i am wrong, please kick me in the nuts...
Post 28 Oct 2008, 01:20
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Quote:

I looks like multilple sections of the same type can be defined, but i dont think that fasm will group them together (like a linker does) so your file size will probably increase due to each sections alignment width.
If i am wrong, please kick me in the nuts...

Exactly there is no such grouping. And you don't only have to account for the alignment but for the extra space required to define the section inside the PE too.
Post 28 Oct 2008, 02:05
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 3018
Location: vpcmipstrm
bitRAKE
The best way I've found thus far is to create object files and link them together. Linkers have a policy used to join sections of same, or similar names. Matt Pietrek explains briefly (just past Figure 2). This allows functionality to be encapsulated within a single source file (and typically a definition of the interface - include file).

Better tools to navigate large sources is required to realize the FASM single source file dream, imho.

_________________
¯\(°_o)/¯ unlicense.org
Post 30 Oct 2008, 19:40
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.