hi everybody!
i know this is my first post and its an 'asking-for-help' one. i?m sorry, i would have prefer it to be a useful one. anyway here it goes.
i have this little piece of code which tries to create a dialogBox using a template and it works ok. the problem is that the exe is 8192 bytes long which looks weird to me. i've compiled and linked using tasm32 and been messing around with the linker options to see if i could reduce the size.
here's the code:
.model flat,stdcall
include c:\lvro.inc
hInstance dd 0
mov eax,
mov hInstance,eax

push 0
push offset mainProc
push NULL
push 44
push hInstance
call DialogBoxParam

push eax
call ExitProcess

mainProc proc stdcall,hWnd:DWORD,wmsg:DWORD,wparam:DWORD,lparam:DWORD
.if wmsg==WM_CLOSE
push 0
push hWnd
call EndDialog
xor eax,eax
mov eax,1
mainProc endp
end start

i am using a template with a dialog box and an only button (966 bytes takes the .res file)

the command line options i use are:

c:\tasm\bin\tasm32 /q /n /ml %F
c:\tasm\bin\tlink32 -x -aa /V4.0 /c /Tpe %P%N,,, import32.lib,,%P%N.res

i did a search on the forum and found two threads about reducing the exe size, but none helped.
can anyone please explain how to shorten the size of the exe. i'm not familiar with tlink32 command options. been reading the help file but doesnt say much. i imagine its all about the linking options but cant find any help on it. there's a lot about masm but not for tasm.
Posted on 2002-05-23 10:56:52 by lapaki
I remember that when I was using tasm even if I included a simple icon in res file of a proggie which just shows MessageBox then exits, it would make the exe 8kb size.
probably tasm adds some useless overlay in the resource section, I don't know for sure since I didn't checked at the time..anyway, look with a peeditor at the size of the resource section, that might be the problem.
Posted on 2002-05-23 15:08:22 by DZA
switch to masm and use /FILEALIGN:512 as linker parameter, if
you really feel that this matters.
Posted on 2002-05-23 15:36:03 by f0dder
thanks for the replies. i tried removing the icon from the resource file and it still takes 8k (the .rsrc section is .5k). i think i?ll move to masm and see what happens. thanks again!
Posted on 2002-05-24 03:17:08 by lapaki
try removing the resource file and compile;)
switching to masm is good idea tho:)
Posted on 2002-05-24 10:35:33 by DZA