🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.msdos.programmer
Article #1190

Re: Borland C/C++ 4.02 Executable size [possible repost]

#1190
From: Bruce Arnold
Date: Sun, 11 Feb 1996 06:41
66 lines
3393 bytes
Kelvin Klijnsma wrote:
> I really like Borland C++ 4.02 but one thing that's very annoying
> (IMHO) is the minimum size of an executable. At the moment I only do
> some DOS programming, but even the most simple utility will at least
> take about 30K. I know that the compiler links in some startup code
> and some necessary libs, but my question is: is there any way of
> reducing the size of the executable. For instance, in Borland Pascal
> you have smart linking and a simple utility need not be larger than
> say 5K.
> Please note that I'm used to program in TASM, i.e. I'm used to being
> in control of what exactly is linked into the program (I guess that's
> really why the minimum size of 30K bothers me :-).
> 
> In short:
> 
>  - How do I reduce the size of compiled C programs for DOS.
>    (And yes, I am aware of executable compressors).
>  - I would like a solution that works for all memory models.
>    (Except tiny model: this model does indeed allow me to
>    produce smaller executables, but I prefer small model).

The following is taken from the Borland 4.51 Readme.txt file.  I don't know
if is applies to version 4.02.
----------------
NOEHxx Libraries
----------------
Purpose:

The NOEHxx libraries eliminates the overhead of exception-handling code in
the run-time library for users who don't need it and who do rely on any
libraries that require it.

How to use:

A NOEHxx library must be linked in before the standard runtime library.
For command-line tools this can be accomplished by specifying the appropriate
NOEHxx library on the BCC command-line, or making it the first library given
to TLINK.

For the IDE, add the appropriate library to the project using AddNode.
To ensure the NOEHxx library is processed before the standard libraries,
turn on "Show Runtime Nodes" in the Options|Environment|ProjectView dialog.
From the project window you can move the library up and down using the
ALT-<arrow> keys. Be sure the NOEHxx library appears before other standard
libraries. Note: use NOEHWL.LIB when building DPMI16 programs.

What they do:

The NOEHxx libraries resolve calls to exception-related compiler helper
functions to dummy functions that return appropriate return values. They
also restore the pre-exception behavior of operator new to return NULL on
out of memory conditions. Non-exception enabled versions of setjmp() and
longjmp() are also provided.

Limitations:

Note: some features introduced in BC4.0 require exception handling.
These include the string class, BIDS container classes, the standard
OWL libraries, and RTTI.

------
End of reference material.

I have used this technique to reduce small programs to 10 K bytes.
Good Luck with your compiler.
...Bruce
Technical Details
Message-ID: <311D8F89.6DB4@vcx.net>
Path: arc1-ca.pugleaf.net!chewy.vcx.net!usenet
References: <4ffk0c$6h4@altrade.nijmegen.inter.nl.net>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!chewy.vcx.net!usenet
From: Bruce Arnold <barnold@vcx.net>
Newsgroups: alt.msdos.programmer,comp.os.msdos.programmer,comp.lang.c
Subject: Re: Borland C/C++ 4.02 Executable size [possible repost]
Date: Sat, 10 Feb 1996 22:41:13 -0800
Organization: Sprint United Telephone/Eastern - Internet @ccess
Message-ID: <311D8F89.6DB4@vcx.net>
References: <4ffk0c$6h4@altrade.nijmegen.inter.nl.net>
NNTP-Posting-Host: y-wing-2a-33.tatooine.vcx.net
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Mailer: Mozilla 2.0b5 (Win16; I)
To: K.Klijnsma@net.HCC.nl