flat assembler
Message board for the users of flat assembler.

Index > Main > Binary components in FASM

Author
Thread Post new topic Reply to topic
AsmGuru62



Joined: 28 Jan 2004
Posts: 1419
Location: Toronto, Canada
AsmGuru62
Hi everyone,

I am working on FASM IDE and I am thinking how to provide code re-use for a projects, which may be developed using IDE.

Currently, I know that FASM can 'include' the source into main ASM file and that would be enough to get some earlier coded component into the big project. That's one method of re-using code (or using a component).

However, there may be a case of a very large project, say thousands of included modules and I am worried that such large code will hit some limits of the FASM compiler.

Another way is that I can use DLLs as components - they export some functions and these functions can be called to re-use code inside a DLL. That is two methods already.

Now, my question: is it possible to use some other kind of binary components in FASM, like an OBJ file? I know FASM can produce COFF files, but can they be used to build other FASM applications or these COFF files used only to integrate with HLLs. Is there something in FASM which can provide the same feature as OBJ files in MASM? I need the ability to build a final EXE for a big project from binary non-DLL components. Is this possible?
Post 01 Jul 2011, 12:10
View user's profile Send private message Send e-mail Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
.obj files are normally linked together using linker to form an executable (.exe or .dll under Windows).
Post 01 Jul 2011, 12:18
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1419
Location: Toronto, Canada
AsmGuru62
Can .OBJ files be linked by FASM itself (without a linker)?
Post 01 Jul 2011, 15:35
View user's profile Send private message Send e-mail Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
Nope
Post 01 Jul 2011, 15:57
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4242
Location: 2018
edfed
what is a linker? Laughing
Post 01 Jul 2011, 23:40
View user's profile Send private message Visit poster's website Reply with quote
typedef



Joined: 25 Jul 2010
Posts: 2913
Location: 0x77760000
typedef
edfed wrote:
what is a linker? Laughing


Laughing
Post 02 Jul 2011, 00:29
View user's profile Send private message Reply with quote
idle



Joined: 06 Jan 2011
Posts: 360
Location: Ukraine
idle
are you talking about os-independent code?
Post 02 Jul 2011, 06:36
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
edfed wrote:
what is a linker? Laughing

It's a thing ignorance of which can make one e-proud.


Last edited by vid on 02 Jul 2011, 14:49; edited 1 time in total
Post 02 Jul 2011, 08:09
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1419
Location: Toronto, Canada
AsmGuru62
So, the only two ways for components are: DLLs and "include 'source.asm'"? That's not much.
Post 02 Jul 2011, 11:11
View user's profile Send private message Send e-mail Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
You can link several obj files to one executable using "linker".
FASM package does not contains linker, but you can use third party one.

I, personally don't like linkers and the one of the main reasons to use FASM is that it can generate executable files in several formats directly.
I believe, most of the FASM users like it because of this feature.

There are 3 main reasons for .obj files use:
1. To be able to link HLL and ASM modules - it serves mainly HLL - assembler does not need HLL modules, but HLL need assembly modules.

2. To allow using closed source modules, accessible only as a object files.

3. To provide faster compilation for slow assemblers and compilers that simply can't compile big sources fast enough.

All 3 reasons are void for FASM. Smile
Post 02 Jul 2011, 11:29
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
mindcooler



Joined: 01 Dec 2009
Posts: 423
Location: Västerås, Sweden
mindcooler
4. Code modularity without having to resort to dlls.

I don't like linkers either, but I would like some kind of (macro-)system that can merge several sources together in an easy way without having to chop up your modules into sections and including them in your main project.
Post 02 Jul 2011, 13:24
View user's profile Send private message Visit poster's website MSN Messenger ICQ Number Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3502
Location: Bulgaria
JohnFound
mindcooler wrote:
4. Code modularity without having to resort to dlls.

I don't like linkers either, but I would like some kind of (macro-)system that can merge several sources together in an easy way without having to chop up your modules into sections and including them in your main project.


Code modularity is completely achievable on source level. You can see FreshLib (and the whole Fresh project) for example how to make it.
If you don't want to deal with source repository, you can download the latest version of Fresh from download page. The package contains full source with many libraries on source level without any dll's or obj files.
Post 02 Jul 2011, 18:17
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
AsmGuru62



Joined: 28 Jan 2004
Posts: 1419
Location: Toronto, Canada
AsmGuru62
That is what I do, basically.
I have Module.Inc (structures, constants and macros) and Module.Asm (plain code) for every module and then just include these as needed.
Post 03 Jul 2011, 00:28
View user's profile Send private message Send e-mail 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.