[Python-Dev] Problems with Python's default dlopen flags

Martin v. Loewis martin@v.loewis.de
06 May 2002 08:31:03 +0200


"David Abrahams" <david.abrahams@rcn.com> writes:

> > That explains a lot of things indeed. It doesn't explain why the
> > exception handling on Linux fails (that should still work fine even
> > with two separate copy of each typeinfo object, IMO),
> 
> Not the way I read http://gcc.gnu.org/faq.html#dso.
> Am I missing something? If an exception is thrown from ext1 -> ext2 and
> they're not sharing symbols, there will be distinct copies of all
> typeinfo objects used in the two modules, and the address comparisons
> used to determine whether a catch clause matches ought to fail, no?

Right. However, address comparisons are used only in gcc 3.0; gcc 2.95
and earlier used string comparisons, and gcc 3.1 will use string
comparisons again. I was assuming that Ralf used gcc 2.95 to build the
binaries.

As Tim explains, if that was the cause, you'ld have a systematic error
(failure every time). If the failure is only sometimes, it must be
something else.

> I don't think Ralf is explicitly using any non-const global objects or
> explicitly relying on on object identity across extension modules, so
> it's hard to imagine that this is at play.

Are you sure there are no objects of static storage duration in Boost?
It doesn't matter whether he uses them "explicitly": if he calls
functions that use them, the object being used depends on which DSO
the caller is in. With RTLD_GLOBAL, all calls go to one of the DSOs
(independent from caller), thus a single and consistent set of global
objects is used.

Regards,
Martin