Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site gumby.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!think!harvard!seismo!uwvax!gumby!g-chapma From: g-chapma@gumby.UUCP Newsgroups: net.lang.c Subject: Re: Undefined static function Message-ID: <449@gumby.UUCP> Date: Fri, 20-Sep-85 15:05:50 EDT Article-I.D.: gumby.449 Posted: Fri Sep 20 15:05:50 1985 Date-Received: Sun, 22-Sep-85 06:14:46 EDT References: <177@polaris.UUCP> Organization: U of Wisconsin CS Dept Lines: 34 Regarding the "undefined static function" problem/question, viz: static char * f(); main () { ... if (f(x)) ... ... } [end of file, no function definition for f] Some compilers allow you to put the definition of statics (functions or variables) in another file, as long as you combine the file containing the definitions with the file containing the references at some point before linkage time. Whitesmiths' C compiler, for example, produces assembly code. You must compile each C source file separately (giving separate files of assembly code), but if you assemble the outputs together, the assembler will resolve the references. The linker then sees no global symbol associated with the statics. I took advantage of this feature to circumvent an inconvenient limit imposed by this compiler on the size of string constants. I wrote a C source preprocessor which replaced specially-marked string constants with references to static string variables, and coded those constants in assembly code in a separate file. I modified the compiler shell script to run the preprocessor before the compiler, and assemble the string constant file along with the compiler output. --Ralph Chapman g-chapma @ wisc-gumby @ uwvax