I got a question on compiling... I donwloaded an example from Ernie's site (the PictureBox progie), and noticed his compiled version is 4Kb. I made absolutely no changes to any file, and simply recompiled it, and it blew up to 16kb!!

My question is why? Should i have "more" switches in my builda.bat file or something?

This is what i use to build:

@echo off

if exist %1.obj del %1.obj
if exist %1.exe del %1.exe

\masm32\bin\ml /c /coff /Zi %1.asm
if errorlevel 1 goto errasm

if not exist rsrc.obj goto nores

\masm32\bin\Link /SUBSYSTEM:WINDOWS /DEBUG /DEBUGTYPE:COFF %1.obj rsrc.obj
if errorlevel 1 goto errlink

dir %1
goto TheEnd

if errorlevel 1 goto errlink
dir %1
goto TheEnd

echo _
echo Link error
goto TheEnd

echo _
echo Assembly Error
goto TheEnd


Thanx for your help...
Posted on 2001-09-04 13:00:34 by NaN
Well I have notice that the /DEBUG /DEBUGTYPE:COFF switchs will increase the since of your files.
Posted on 2001-09-04 14:43:07 by Eóin
First of all, it's really "assembling" and not "compiling". Second, you
might want to mess with /FILEALIGN ... for example, /FILEALIGN:512.
Or /OPT:NOWIN98, which does exactly the same. And sure, debug
info will add some meat to the executable as well.
Posted on 2001-09-04 14:52:14 by f0dder
Well.. i've been struggling with this friend of mine for ever and ever.
He says 'compile' i say 'assemble'. He even showed me some Numega docs which also sayed 'compile' instead of 'assemble'.
I think it just roles off the tongue more easily..

I'd start a new thread in The Crusades...but i'm lazy :)

Posted on 2001-09-04 15:17:33 by latigo
Probably also the /Zi switch will increase the size (surely for the obj file... not sure for exe file). Zi stands for "Generates CodeView information in object file".


Posted on 2001-09-04 15:42:48 by dguzz
The reason your exe blew up to 16 is due to the debugging information you are putting into the exe with your bat file. A handy thing to do is to accept another parametter on the command line
that determines if you want to build release version or debug version.
for example
build.bat filename, RELEASE
could hypothetically assemble and link like
ml /c /coff /Cp %.asm

link /SUBSYSTMEM:WINDOWS /RELEASE /MERGE:.rdata=.text /SECTION:.text,EWR /IGNORE:4078 %1.obj

else if DEBUG is passed then compile with debugging info..

You could also throw in switches to set the subsystem, alignment, ect.

Hope this helps
Posted on 2001-09-04 16:11:27 by prs
Thank you all very much... I feel stupid for not realizing this... gues its since i use the Bat's so much you forget the meaning of all the switches...

I was thinking it was an included lib or something that had not direct refence to.... doh!

Thanx all again! (now my object set doesnt look so bloated.. It reduced an example file from 26K to 9K!!)

Posted on 2001-09-04 16:31:21 by NaN
Makefiles are very handy for having different build versions as well.
Posted on 2001-09-04 18:09:08 by bitRAKE