From owner-freebsd-hackers Wed Feb 26 04:28:07 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id EAA04974 for hackers-outgoing; Wed, 26 Feb 1997 04:28:07 -0800 (PST) Received: from parkplace.cet.co.jp (parkplace.cet.co.jp [202.32.64.1]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id EAA04969 for ; Wed, 26 Feb 1997 04:28:03 -0800 (PST) Received: from localhost (michaelh@localhost) by parkplace.cet.co.jp (8.8.5/CET-v2.1) with SMTP id MAA23796; Wed, 26 Feb 1997 12:27:47 GMT Date: Wed, 26 Feb 1997 21:27:47 +0900 (JST) From: Michael Hancock Reply-To: Michael Hancock To: Zach Heilig cc: Peter Haight , freebsd-hackers@FreeBSD.org Subject: Re: Static variables in shared libraries In-Reply-To: <87rai36gyn.fsf@murkwood.gaffaneys.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk On 26 Feb 1997, Zach Heilig wrote: > >>>>> "Michael" == Michael Hancock writes: > > > Try news:comp.lang.c. "The C book" is also a necessity. > > You'll probably be flamed to hell and back there for posting about > unix-specific (or -specific) code, a better bet would be > news:comp.unix.programmer > > Of course they all will probably send you back over here, since you > are using FreeBSD :-) $ vi foo.c #include const char* test_3 = "hello"; const char* test_4 = test_3; main() { printf("test_3 = %s\n", test_3); printf("test_4 = %s\n", test_4); return 0; } :wq $ lint foo.c (4) error: non-constant initializer: op "NAME" lint: errors in foo.c; no output created lint: pass2 not run - errors in foo.c Ok, this doesn't even compile. But if he's using auto-variables then the only thing I can think of is that the printf's are in his program while the variables are in the shared lib so he is trying to print something that's already been released and partially reused for something else. I could be wrong but it just smells more like a C problem than anything to do with the shared library facility. Regards, Mike "That's not a bug, that's a feature." ;-)