www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/21/06:09:30

From: Ali Bharmal <nab26 AT cam DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Reduce .exe file size
Date: Mon, 21 Apr 1997 09:46:38 +0100
Organization: Bing's Bollege, The Uni-VARSITY of Bambridge
Lines: 61
Message-ID: <335B296E.D0A@cam.ac.uk>
Reply-To: abharmal AT hotmail DOT com
NNTP-Posting-Host: quango.sel.cam.ac.uk
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi,
 Being a newcomer to the world of DJGPP (my only previous C++ experience
being
with Borland), I have a querry as how to reduce .exe file size.
 Now I read in the FAQ that all (!) that had to be done was to;

 1) Remove all debugging stuff from the object files
 2) Strip out unecessary symbols [1) really]
 3) And in my case, since I didn't want any globbing or loading of
enviroment
    vars, and the program didn't use any arguments, I could redefine 3
funcs
    to be empty and cause my greater code size reduction.

 1) and 2) are cool, but 3) is causing me major hassle. Basically, the
code I
try to use is that shown below, but the problem is that is ignored.
Why?!?!
I'm obviously doing something wrong, the outcome of my code is that
these
'dummy' functions are ignored or not linked in. This is shown, because
when
built, my program does not do any of the 'cout'ing I wrote in.

 If you can help (or I missed the obvious) then please email me,

 Thanx,

---start---

// These are here to reduce personal.exe size, they are just dummy funcs
        static void   __crt0_load_environment_file(char *_app_name);
        static void   __crt0_setup_arguments(void);
        static char **__crt0_glob_function(char *_arg);

...some code...

typedef struct array {
	char name[20];
};

static void     __crt0_load_environment_file(char *_app_name) {cout <<
"loadenv\n";};
static void     __crt0_setup_arguments(void) {cout << "setuparg\n";};
static char   **__crt0_glob_function(char *_arg) { cout <<
"glob\n";return(0);};

void main()
{
...the main stuff...
}

---end---

-- 
 __________________________________________________________
|  _     _                    Selwyn College, Grange Road, |\
| |_||. |_)|_  _  _  _ _  _ | Cambridge CB3 9D             ||
| | ||| |_)| |(_|| '| | |(_|| abharmal AT hotmail DOT com         ||
|__________________________________________________________||
 \__________________________________________________________\

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019