This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
dlopen and template instantiation
- From: Stefan Seefeld <seefeld at sympatico dot ca>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 15 Jul 2003 11:39:34 -0400
- Subject: dlopen and template instantiation
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...
Thanks a lot,
Stefan