News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Linking VS Including

Started by redskull, May 30, 2006, 01:08:23 AM

Previous topic - Next topic

redskull

I know the 'official' old-school style of modularizing code involes seperatly assembling them, defining procedures and variables global with EXTERN and whatnot, using make files, linking them together; the whole three ring circus.  But lately, i've gotten into a bad habit of just INCLUDING seperate files with the procedures written in them, saving me the hassle of determining scope and assembling everything a la carte.  Other than longer assembly times (not that it's much of a factor these days) and a bad chastizing from old programming teachers, is there any specifically wrong with doing it this way?  It just makes everything SO much easier

alan
Strange women, lying in ponds, distributing swords, is no basis for a system of government

Synfire

I generally see no problem with this. One exception is if you don't use PROC/ENDP and you define a named label, then that label is global and can cause errors if you use that label name again. This also goes for variables, etc. Also a good reason not to use this method is in the case of custom equates, if both sources use a different value for the equates, then you are either going to get an error (in the case of most assemblers) or it will be redefined at a possibly invalid time (in the case of assemblers like MPASM which allows equate redefinitions). Other than that, I can't think of any other reason it shouldn't be done. I personally use LIB's for routines and MACRO's for snipplets, both held in their own includes.

hutch--

Red,

It has a bit to do with the size of the project, on small to medium sized projects it does not matter much but if you are building something large and complex, the modular approach starts to make things a lot easier and you can easily build complete modules into your own library. It also helps if you write reusable code so you can use that library in another project.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

zcoder

The modular approach is alot better to use, you can create larger programs and still keep
your app managable. the problem is with assembling all those files into OBJ's then linking.

I made a IDE to do all this with one click to assemble a project, I made it mimic VC++
but for assembly.

You can give it a try at: www.masmwizard.com/about.php

otherwise you can make bat files to do this for you, for each project.

Zcoder....
Back in 1979, My computer ran so fine.
And there was no such thing,
As a Microsoft Crashed Machine.
http://zcoder.110mb.com
http://www.dietzel.com/partner/idevaffiliate.php?id=345_6  Free Domain Names