dlopen and template instantiation

Stefan Seefeld seefeld@sympatico.ca
Tue Jul 15 16:06:00 GMT 2003


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



More information about the Gcc mailing list