[C++-sig] Strange boost python error message (and solution)

Niall Douglas s_sourceforge at nedprod.com
Thu May 25 14:05:14 CEST 2006


On 24 May 2006 at 9:12, Ralf W. Grosse-Kunstleve wrote:

> I am still worried about the function pointer comparison. It seems unlikely to
> me that the double-registration originates from a single extension; that would
> be very easy to avoid. If the same to_python converter is defined in two
> different extensions, are we sure that the address comparison is meaningful? I
> am thinking the machine code for the function exists independently in each
> extension, i.e. has two different addresses. Does the dynamic loader eliminate
> the duplication on all platforms? Is the behavior the same with, e.g.
> RTLD_LOCAL and RTLD_GLOBAL?

It's worse than that.

If you resolve a symbol and store its address, when another shared 
object is loaded which also has that symbol then its address 
magically changes with RTLD_GLOBAL.

With RTLD_LOCAL, the symbol depends on what code is asking for 
resolution. In one shared object you will get a different value than 
another. In this case you would have multiple copies of the BPL 
object in memory at once which probably breaks lots of other things 
anyway.

If I were you, I would compare pointers as a quick case scenario. If 
different, you'll need to do a string comparison. This sucks, but 
anything else isn't correct.

Cheers,
Niall






More information about the Cplusplus-sig mailing list