Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site alice.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!alice!mjs From: mjs@alice.UUCP (M. J. Shannon, Jr.) Newsgroups: net.lang.c Subject: Re: Variables Message-ID: <3104@alice.UUCP> Date: Wed, 14-Nov-84 09:03:28 EST Article-I.D.: alice.3104 Posted: Wed Nov 14 09:03:28 1984 Date-Received: Thu, 15-Nov-84 02:41:30 EST References: <4583@ukc.UUCP> Organization: AT&T Bell Laboratories, Murray Hill Lines: 45 The way to do what you want is something like this: /* file libstuff.h: */ extern int globlibfunc0(); extern double globlibvar0; /* file libstuff.c: */ #include "libstuff.h" double globlibvar0 = 3.1415926535; static locallibvar0 = 17; static int locallibfunc0(); static int locallibfunc0(x, y, z) double x, y, z; { x /= y; z /= x; return (x < z); } int globlibfunc0(x, y) double x, y; { return (locallibfunc0(x, y, locallibvar0)); } /* file main.c: */ #include "libstuff.h" main() { double x, y; (void) scanf("%g,%g\n", &x, &y); printf("%d\n", globlibfunc0(x, y); exit(0); } The magic invloved is the keyword `static', which makes the identifier local to the file in which it is declared (in which file it must also be defined). The header file should contain only aggregate declarations (struct, union, enum, typedef, etc.) and function declarations, all of which should be preceded by the keyword `extern' to indicate that they're not defined here.