I was just noticing how big of a executable TLINK32 had produced out of the TASM32 assembled files. The minimum file-size was 4kb, and this really caught me by suprise, as the .obj file was rather small. For a simple messagebox application, in MASM, it's usually 1kb (with merging sections, file align, etc.), but there is no way to alter and merge the sections under TASM. I was wondering if anybody knew how to produce smaller TASM executables, since i've seen it done before (a few instances of 2-2.5kish apps, and i'm pretty sure they weren't compressed/packed/encrypted either...). When i had tried to link the TASM .objs with the MS linker, it spurted out a bunch of errors...so....


any help will be appreciated :)
Posted on 2003-06-29 14:19:57 by Drocon
Hello,
TLink32 can't generate exes which size is smaller than 4K.
If you really want small size, you can try other two linker.
One is WLink, which comes in Watcom C++ package, it's really powerful and complex to use :)
The other is ALink, that said it supports Borland OMF object file and it can generate small executables. But I haven't test ALink yet.
Posted on 2003-06-29 21:29:58 by KomsBomb
Yes, minimum 4069 bytes, full of zero. Padded to this length. I think this is not a problem. But you may try ALink. This is my test app, %20 smaller :)
Posted on 2003-06-29 21:50:53 by cakmak
Drocon,

You can use Tasm with MS Link to get an executable of 2.0-2.56Kb.
The trick is to use new import libraries which contains "undecorated" API names.
You can check this thread:

http://www.asmcommunity.net/board/index.php?topic=13805
Posted on 2003-06-30 05:55:46 by Vortex
Thanks :)

but the a problem i'm facing when linking TASM files with MS-Link is that it doesn't recognize the entrypoint:


C:\ASM\TASM\EXAMPLE>c:\masm32\bin\link /subsystem:windows kernel32.lib user32.lib
gdi32.lib codegen.obj
Microsoft (R) Incremental Linker Version 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

codegen.obj : warning LNK4033: converting object format from OMF to COFF
LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup
codegen.exe : fatal error LNK1120: 1 unresolved externals


anybody has any idea how to fix this? i've tried various methods, but no luck :stupid:
Posted on 2003-06-30 09:35:54 by Drocon
i fixed it :)

in front of "start:" i had to insert "Public C start", and under mslink, add a /entry:start , it was as simple as that :)

if anybody wants an example, i'd be happy to post one :)
Posted on 2003-06-30 09:41:30 by Drocon
Hi Drocon,
i only wonder where did you found that "public C" stuff?

Thanks
Posted on 2003-07-02 15:39:15 by cakmak
Drocon,

Did you solve the problem about the double underscores?
Posted on 2003-07-03 06:32:01 by Vortex
yep :) thanks for all the help !

i've attached a 1kb msgbox example, of how to link it with MS-Link, the zip also includes "kernel32.lib" and "user32.lib", which were built from Vortex's excellent "dll2lib" application :)
Posted on 2003-07-03 12:31:52 by Drocon
Drocon,

I am glad you solved the problem. :)
You can use my external function scanner V3.0,it supports Tasm,so you don't have
to declare the external functions.
Posted on 2003-07-04 07:42:38 by Vortex
Drocon,

Thanks for example but where did you find info about that "public C" line?
Posted on 2003-07-04 18:25:47 by cakmak
i suppose understood, for automatically prefixing underscores in .obj.
Posted on 2003-07-04 18:33:44 by cakmak
Cakmak,

You don't need of underscored names.You can check my "scanner" examples. :)
Posted on 2003-07-05 03:20:42 by Vortex
Yes Vortex,

Yuo are right, it was stupidly, as i was know that... But i still wonder what for that "public C"? Do you know?

Thanks
Posted on 2003-07-05 22:15:38 by cakmak
Cakmak,

I haven't any idea about "public C"
Posted on 2003-07-06 03:23:08 by Vortex
i saw the "public c" line used in EliCz's EliASM examples :)
Posted on 2003-07-06 09:33:47 by Drocon