[Python-Dev] Problems with Python's default dlopen flags
David Abrahams
David Abrahams" <david.abrahams@rcn.com
Sun, 5 May 2002 17:16:06 -0500
From: "Jack Jansen" <Jack.Jansen@oratrix.com>
>
> On zondag, mei 5, 2002, at 11:08 , David Abrahams wrote:
>
> > That's hardly the only question:
> >
> > If A needs to throw an exception which is caught in B, what is
> > "the glue
> > code" that you put in ABglue.so?
> >
> > If a class with inlined virtual functions is used by A with
subclasses
> > defined in B, what is the "glue code"?
> >
> > What about templates? ;-) (vague, but relevant)
>
> Well, you're now going into territory where I'm not really
> familiar, C++, and more precisely it's runtime system on various
> platforms (especially the stuff with zero-overhead runtimes and
> such tends to make my head explode), but I would guess that if
> you take the code from A that declares symbols used by B and
> vice versa and move that to a common ancestor you should be done.
Speculation aside, the RTTI info which allows the compiler to identify
exceptions is never explicitly declared by the user. In some
implementations it's generated automatically wherever the first declared
virtual function is implemented. I don't know what the rules are when
there are no virtual functions, or the virtual functions are inlinied,
or the thrown type is a tempalte which is instantiated implicitly... of
course this is OT for Python-dev but I'm hoping now that I've got the
attention of MvL (a gcc developer) he'll answer these questions or
direct me to someone who can ;-)
> If all else fails you could even take the whole A module except
> the init routine and stuff it in Acore.so, similarly for B, link
> Acore.so against Bcore.so and vice versa and have the A and B
> modules be skeletons with just the init routine. That way you
> know that your Acore and Bcore will be loaded via the normal
> shared library loading method, which probably handles
> initializers and cross-segment exceptions correctly,
Yes, now we're back to MvL's suggestion to use shim libraries, which
provides very certain behavior but also complicates building and
deployment.
-Dave