News:

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

Modularity?

Started by Flexer, November 27, 2006, 09:26:23 PM

Previous topic - Next topic

Flexer

Hi
I'm new on this forum, and in ASM programming too..
Before I was programming in Delphi, and i'm quite used to separating parts of code in separate modules. To make it clear, I'm not talking about dll's. It's separate .pas (.asm in MASM :) ) files linked via uses (include). And in the end it should be one .exe file..

Is it possible to do the same in MASM? To have functions and "variables" is separate files..
As far as I understand, it will be done as several data and code segments. Am I right? And what are the negative sides of that?

Thanks in advance :)

u

Yes, we put our code into .lib files. Or simply .obj files, then link. RadASM and the other IDEs do the second type of linking automatically.
.obj files are assembled .asm files  (ml.exe)
.lib files are archives of .obj files (link.exe)
Please use a smaller graphic in your signature.

Flexer

So the question is then, will it create several segments of code and data or not?
For example if I want to have a separate file with several strings in it. How would I do it? Do I have to add another .data in it? Will it be worse than having a all-in-one? Or it's the same?

u

You can create .data and .code and .data? and so on...
And linking .obj or .lib will never create any problems ;)
Just remember to use the declarations "public"  and "externdef"

From the different .obj files, sections are concatenated, while being 16-byte-aligned . So in the final .exe, you have only one .data, only one ".data?"  (aka "BSS") and only one .code (aka "text") section.
Please use a smaller graphic in your signature.

Flexer

Ok )
This probably solves all my problems :)
Thanks )