This is the mail archive of the
mailing list for the GCC project.
Re: dlopen and template instantiation
- From: "H. J. Lu" <hjl at lucon dot org>
- To: Stefan Seefeld <seefeld at sympatico dot ca>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 15 Jul 2003 08:43:01 -0700
- Subject: Re: dlopen and template instantiation
- References: <da714665049e0dd5b743aabb238434683f141d1a@Orthosoft.ca>
On Tue, Jul 15, 2003 at 11:39:34AM -0400, Stefan Seefeld wrote:
> hi there,
> I'v a problem with duplicate template instantiation in code
> using dlopen...
> I'm using a 'singleton' template to access a global object.
> The singleton is accessed from within a library libfoo.so,
> as well as from within a python module bar.so (written with
> boost::python), which is linked to libfoo.so.
> When I run a python script that uses the 'bar' module, I see
> that two distinct instances of the singleton are accessed.
> How does gcc deal with this case ? Shouldn't static template members
> be defined as weak symbols such that only one instance is used ?
> Is there anything I have to do to make template instantiation work
> with dlopen ?
> I'm using RH 9 with gcc 3.2...
It may be a glibc issue. See