www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/04/21/22:54:37

From: "John M. Aldrich" <fighteer AT NO DOT SPAM DOT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Reduce .exe file size
Date: Mon, 21 Apr 1997 08:18:35 +0000
Organization: Two pounds of chaos and a pinch of salt
Message-ID: <335B22DB.1A20@NO.SPAM.cs.com>
References: <335B296E DOT D0A AT cam DOT ac DOT uk>
Reply-To: fighteer AT cs DOT com
NNTP-Posting-Host: ppp108.cs.com
Mime-Version: 1.0
Lines: 31
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Ali Bharmal wrote:
> // 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);

There's a problem with this that's more than just declaring the
functions static.  By leaving out the function bodies, and just
terminating the function declarations with semicolons, you are
*declaring* the functions, not *defining* them.  The compiler just goes
ahead and says, "Oh, now I know what these functions look like," and
promptly forgets about them.  If you had included <crt0.h> you'd have
gotten warnings about multiple declarations of those functions.

Also, you MUST have your dummy __crt0_glob_function() return NULL, or
the startup code will crash messily.  I know this from experience.  ;)

Try the following instead:

#include <crt0.h>
void   __crt0_load_environment_file(char *_app_name) {}
void   __crt0_setup_arguments(void) {}
char **__crt0_glob_function(char *_arg) {return NULL;}

hth!
-- 
---------------------------------------------------------------------
| John M. Aldrich, aka Fighteer I |     mailto:fighteer AT cs DOT com      |
| Proud owner of what might one   |   http://www.cs.com/fighteer    |
| day be a spectacular MUD...     | Plan: To make Bill Gates suffer |
---------------------------------------------------------------------

- Raw text -


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