Hi!

I'm new to masm32 and tried the tutorials on this page.

The second win32 tutorial describes how to assemble this
code:

.386
.model flat, stdcall
option casemap:none
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\kernel32.lib
.data
.code
start:
invoke ExitProcess,0
end start

My problem is that everything works fine (no error messages) but
the exe-file ist about 16KB and not 1,536Bytes.

I've also tried to build some of the examples that come with masm32, e.g. "qexit".
I used the "makeit.bat" for this one and the exe is 8Kb but it should be only 1Kb.

What's the problem???
I use masm32v7 and didn't modify it in any way.
ml.exe version is 6.14.8444
Posted on 2002-05-21 06:33:03 by seppel
post your assemble & link commands, you probably included debug info or maybe a resource file?
Posted on 2002-05-21 06:54:33 by Hiroshimator
I used the same commands as in the tutorial:

ml /c /coff /Cp msgbox.asm


link /SUBSYSTEM:WINDOWS /LIBPATH:c:\programme\masm\lib msgbox.obj

no res-file...

The only difference to the tutorial-code is that I used different path's for the include(lib) command(s), e.g.:

include c:\programme\masm\include\windows.inc
Posted on 2002-05-21 07:37:39 by seppel
By any chance do you have Visual C++ installed?
It too has a linker called link.exe, and its linker defaults to a larger size section size. It is also the link.exe that is pathed in...
Specify C:\masm\bin\link.exe when you do your linking...

Mirno
Posted on 2002-05-21 08:28:50 by Mirno
Holy ****!

That's it! I really used the vc++ linker all the time.
I didn't think of that :)

Thank you!
Posted on 2002-05-21 08:45:36 by seppel
seppel, newer version of link by default uses filealign of 4096, since
that's the pagesize on IA32, and generally nice and everything in
larger programs. You can use the /FILEALIGN:x switch to control
file alignment, the minimum acceptable value (to get EXEs that run
on all win32) is 512. Yup, this means you can discard link.exe from
masm32 and only use vc link.
Posted on 2002-05-21 09:54:29 by f0dder
hmmmm,

You are safer to stick with the linker from the win98ddk that MASM32 comes with as it defaults to a much smaller size than the vc linker. VC may have size/speed problems that require this alignment but MASM does not so as long as you specify the path of the linker in MASM32, you will not have any problems.

Regards,

hutch@movsd.com
Posted on 2002-05-21 11:02:02 by hutch--
yadda yadda. /FILEALIGN:512 (or /OPT:NOWIN98) take care of the
"bloated executables" (not that you will be able to see much file
size difference with "real world apps", filealign fiddling only really
shows up with very small files).


VC may have size/speed problems that require this alignment but MASM does not

Pft. It's about letting the VM subsystem be more effective with larger
executables, and applies for *any* languge. Yes, even asm. But perhaps
you don't write large stuff in asm... I guess not, as that doesn't
really make much sense.
Posted on 2002-05-21 11:25:10 by f0dder
I have to go with f0dder on this one, the difference in file size is virtually non-existant. A quick back of the envelope calculation I think I could (at most) save about 35 Mb of hard disk space if every exe, and dll on my computer were using the smaller section size. This is on a hard disk where I loose more because the manufacturer quotes kilobytes as 1000 bytes etc.

I think I can spare that.... Even if the speed up is marginal.

Mirno
Posted on 2002-05-21 11:33:06 by Mirno