News:

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

DIVIDE ET IMPERA

Started by frktons, September 14, 2010, 04:53:36 PM

Previous topic - Next topic

redskull

Take care to notice that one big file is NOT exactly the same as several little ones linked together; different modules also means differnt variable scoping.  A variable can be global to one module or global to *all* modules, so it can help you keep things organized (or drive you nuts tracking down missing references).

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

Gunther

Quote from: redskull, September 14, 2010, 11:51:32 pmTake care to notice that one big file is NOT exactly the same as several little ones linked together; different modules also means different variable scoping.

Good point. One large source file or several small files might be in assembly language a matter of taste. But the picture is changed dramatically by writing blended code. The hole bunch of command line switches of some compilers makes it necessary, to split the source in parts, which are compiled different.

Gunther
Forgive your enemies, but never forget their names.

frktons

Quote from: Gunther on September 14, 2010, 11:33:14 PM
Quote from: redskull, September 14, 2010, 11:51:32 pmTake care to notice that one big file is NOT exactly the same as several little ones linked together; different modules also means different variable scoping.

Good point. One large source file or several small files might be in assembly language a matter of taste. But the picture is changed dramatically by writing blended code. The hole bunch of command line switches of some compilers makes it necessary, to split the source in parts, which are compiled different.

Gunther


Well, as redskull says, we have to take care of variable scoping.
Regarding Assembly blended with C, I'm going for INLINE Assembly
for the time being, so no big problem until I switch to 64 bit programming.

Frank
Mind is like a parachute. You know what to do in order to use it :-)

GregL

I use static libraries to include. Exactly the same as the masm32 library is done. Each procedure in a separate .asm file, assembled into an .obj file and then all related .obj files linked into a .lib file to include in your program later. When it is done this way the linker only links in the procedures you actually use into your program.

ToutEnMasm

Hello,
What i can say on the subject:
-DLL are useful for shared resources.If there is further instances of your program running at the same time,the used resources are loaded only once and this made your code smaller.

-Only one file or further ?
This depend of the IDE you use to write your code.
You have to consider the time needed to navigate threw the code.
My ide made the search for you (as vcexpress do) with a right clic and there is only advantages to break the code in small pieces.Each file can have is own utility and things are clearer like that.




untio

Hi,
I am only a hobbyist programmer. I use dll when it can be used in more than a program and it does all its work. I have a project in sourceforge that calculates a calendar "josecalendar'. The calendar calculation is made in a dll and the program manages the window. A dll is useful if you want to use your code in more than one language and compiler, because linking object modules of two compilers, masm and gcc by example, can be a disaster. Object files, library files and source code can have a problem: the duplicity of names. Personally, to avoid this I give a name to each source module of two or three words. After that, every symbol inside a module starts with the first letter of the three words:
FilesListView.c
flvOnCreate();
And is better not to use variables from other modules. When I need one of then I create a local variable that receives the same value.
Please, forgive me if it is not useful.

oex

I tend to work in the 1,000ish function range of apps written in different languages including PHP/Javascript, VB and ASM.... Every language has it's quirks and just as you dont write English Right to Left you should generally organise your code based on the strengths of the languages.... I manage all my code (except VB) in notepad, writing my own management interfaces as my code base grows, I found this highly successful in PHP however what works in one language doesnt necessarily work in another, ASM is also proving very notepad friendly.... I dont like any text out of line, I work based on layout not bold text and colors, this is my personal preference, monotone type is perfect for my needs.... PHP and ASM can be equally hard once the size of the code base outweighs the complexity of coding the language.... Constantly analyse how you are maintaining your code, remember, like a simple algorithm, you have always got it wrong because there are always simpler and more efficient ways you can organise it....

Unlike some of the pros on this forum I have only 12 years coding experience (and no formal education past 16) so I scour every example for ideas and reasoning behind code and even layouts.... Good ideas for coding can be drawn from the most surprising subject matter and conversational topics :bg
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv