I tried to use the linker of Digital Mars and I got a smaller executable:




ml /c /Cp Win.asm ;generates OMF code for the linker
\dm\bin\link -SU:WINDOWS -FIXE Win.obj ;Fixed executable



Using the libraries of DM:




includelib \dm\lib\user32.lib
includelib \dm\lib\kernel32.lib



The attachment contains an example(Icz. tut. #3)
Instead of 2560 bytes ----> 2076 bytes.

The compiler and the other tools from DM are free:

http://www.digitalmars.com
Posted on 2003-04-23 07:47:02 by Vortex
probably a smaller dos stub? That can be fixed with ms link, too.
Posted on 2003-04-23 07:57:11 by f0dder
f0dder,

Yes,you are right:The DM linker has a smaller stub.
How can I reduce the size of DOS stub while using the MS linker?
Posted on 2003-04-23 08:01:12 by Vortex
Create a smaller dos stub, and use the /STUB: linker parm.
Posted on 2003-04-23 08:04:10 by f0dder
f0dder,

Yes,I know that trick but the smallest DOS stub built with the /KNOWEAS option
has the size of 500 bytes. So,what we can do to reduce this size?
Posted on 2003-04-23 08:14:05 by Vortex
/KNOWEAS ?
Anyway, for standard PEs, you'll have to accept some minimum size. It's silly anyway, except if you're doing 4ks or whatever.
Posted on 2003-04-23 08:22:33 by f0dder
f0dder,

If you are building a stub for PE executables,you need to use the /KNOWEAS option.

Thanks for your help.Still,by using a smaller stub,I get a smaller executable of 2048 bytes with
the MS linker.
Posted on 2003-04-23 08:30:44 by Vortex
I think the DOS stub must be in MZ format, here is a FASM example (in the thread) of a stub:
http://www.asmcommunity.net/board/index.php?topic=6884&highlight=stub
Posted on 2003-04-23 15:26:53 by scientica
Does Digital Mars linker recognize MS-COFF format? Last time I checked (version 8.32) it did not.

There has been discussion about adding MS-COFF support to the linker in order to use PSDK without modification. That is, instead of relying on DMC distributed version of (old) PSDK libraries, people wanted to use the latest PSDK from MS. Yet, I do not know of any indication of COFF support feature in DM linker. Do you have a URL?
Posted on 2003-04-23 17:19:11 by Starless
Starless,

Previously,DM offered a free COFF2OMF tool which converts any COFF format library and
object file.It's a very powerfull tool;but now it's a part of an additional package.(not anymore free)
Posted on 2003-04-24 03:05:51 by Vortex

I tried to use the linker of Digital Mars and I got a smaller executable:


If you want the smallest code the /align switch on ms linker gives yet smaller image, the alignment values produces linker warning as this alignment is used for device drivers but works fine on my XP...
Posted on 2003-04-24 14:36:06 by _Servil_
don't use align, use filealign. And don't go lower than 512. And again, only use if you need to (4k intros whatever).
Posted on 2003-04-24 14:40:03 by f0dder
_Servil_,

Thanks for the sample.Just as f0dder said,we must
be carefull with the alignment value to avoid some problems.
Posted on 2003-04-25 03:05:19 by Vortex