www.delorie.com/archives/browse.cgi | search |
From: | "Brett Porter" <blp01 AT uow DOT edu DOT au> |
Newsgroups: | comp.os.msdos.djgpp |
Subject: | Re: Excluding Unused Functions from EXE |
Date: | Mon, 14 Sep 1998 19:03:41 +1000 |
Organization: | University of Wollongong, Australia |
Lines: | 59 |
Message-ID: | <6tim2b$eel$1@wyrm.its.uow.edu.au> |
References: | <35FCD776 DOT 759A AT hotmail DOT com> |
NNTP-Posting-Host: | ceast29.uow.edu.au |
NNTP-Posting-Date: | 14 Sep 1998 09:02:03 GMT |
To: | djgpp AT delorie DOT com |
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
As with every compiler I know of, GCC does not allow this. You have to put all of the functions in separate source files. All these will be compiled to .o files and the linker will leave out any .o files that are not referenced. This is mostly relevant to libraries... if you are just writing a normal project, why do you write functions that you don't use? :) HTH Brett -- -+-+- Brett Porter <blp01 AT uow DOT edu DOT au> http://members.xoom.com/brett_porter Programmer for Softorange Interactive http://www.softorange.com -+-+- John Simon Churchill wrote in message <35FCD776 DOT 759A AT hotmail DOT com>... >if I have a file with 3 function in and I only use one how can I compile >the exe so it only includes the code for the functions I call >, do I need certain command line options to GCC > >ie. I have the following three files and only want first(), >thanks in advance >Simon... > >-------------------------- >testmain.c >-------------------------- >#include "test.h" >int main(void){ > first(); > return(0); >} >-------------------------- >test.h >-------------------------- >void first(void); >void second(void); >void third(void); >-------------------------- >test.c >-------------------------- >void first(void){ > int x; > x=0x37; >} >void second(void){ > int x; > x=0x37; >} >void third(void){ > int x; > x=0x37; >} >--------------------------
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |