Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Feb 1997 11:01:23 -0700 (MST)
From:      Terry Lambert <terry@lambert.org>
To:        bakul@torrentnet.com (Bakul Shah)
Cc:        peterh@prognet.com, freebsd-hackers@FreeBSD.ORG
Subject:   Re: Static variables in shared libraries
Message-ID:  <199702251801.LAA26691@phaeton.artisoft.com>
In-Reply-To: <199702251650.LAA01376@chai.plexuscom.com> from "Bakul Shah" at Feb 25, 97 11:50:21 am

next in thread | previous in thread | raw e-mail | index | archive | help
> > I have a shared library which has the following definitions:
> > 
> > const char* test_3 = "hello";
> > const char* test_4 = test_3;
> > 
> > If I dynamically load this shared library in my program and print the
> > variables, I get:
> > test_3 = "hello"
> > test_4 = 0x0
> > 
> > What's going on?
> 
> May be shlib linking is broken?

Looks more like an agregate initialization problem with consts not
being treated as fixed addresses by the compiler the way strings are...
in other words, a compiler or linker bug resolving the test_4 address
to the address of the agregate initialized data containing the string
"hello", and the same address as it resolved test_3 to.

On wonder why you want to establish a const alias, actually.  The const
definition implies noalias.  8-|.


					Regards,
					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702251801.LAA26691>