From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Wed, 12 Jul 2000 17:44:55 -0400 From: Latchesar Ionkov To: 9fans@cse.psu.edu Subject: Re: [9fans] Silly porting fun Message-ID: <20000712174455.A20431@gmx.net> References: <20000712141620.A1017@cyber-dyne.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <20000712141620.A1017@cyber-dyne.com> Topicbox-Message-UUID: d91cb560-eac8-11e9-9e20-41e7f4b1d025 On Wed, Jul 12, 2000 at 02:16:20PM -0700, Randolph Fritz said: > > The typical minimal main program from a GNU configure script is: > > main() { return(0); } > > The compiler, reasonably enough, decides that this routine never does > anything and is never called, and optimizes it out of existence! The > linker then cannot find main(), and fails. Is there an option switch > (preferably) or #pragma I can give to alter this behavior? Failing > that, would adding "USED(main);" to the program do the trick? Compiler cannot decide whether a (global) function is used or not -- that's linker job. Anyway, if you add #include "u.h" #include "libc.h" in your minimal program it will compile and link just fine. Regards, Lucho