[Xapian-tickets] [Xapian] #522: Search::Xapian Perl module should specify RTLD_GLOBAL in dlopen call

Xapian nobody at xapian.org
Wed Dec 8 22:05:29 GMT 2010


#522: Search::Xapian Perl module should specify RTLD_GLOBAL in dlopen call
--------------------+-------------------------------------------------------
 Reporter:  dskoll  |       Owner:  olly
     Type:  defect  |      Status:  new 
 Priority:  normal  |   Milestone:      
Component:  Other   |     Version:      
 Severity:  normal  |    Keywords:      
Blockedby:          |    Platform:  All 
 Blocking:          |  
--------------------+-------------------------------------------------------
 If you're using Search::Xapian as well as other C++ code that links
 against libxapian.so, C++ exceptions mysteriously fail because the weak
 symbols in each .so don't match, so the C++ runtime cannot identify the
 types of the exceptions.

 A simple one-line patch to Xapian.pm fixes the problem:

 diff --git a/Xapian.pm b/Xapian.pm
 index 643edc1..d071721 100644
 --- a/Xapian.pm
 +++ b/Xapian.pm
 @@ -38,6 +38,11 @@ require DynaLoader;

  our @ISA = qw(DynaLoader);

 +# We need to use the RTLD_GLOBAL flag to dlopen() so that other C++
 +# modules that link against libxapian.so get the *same* value for all the
 +# weak symbols (eg, the exception classes)
 +sub dl_load_flags { 0x01 }
 +
  # This allows declaration      use Search::Xapian ':all';
  # If you do not need this, moving things directly into @EXPORT or
 @EXPORT_OK
  # will save memory.

-- 
Ticket URL: <http://trac.xapian.org/ticket/522>
Xapian <http://xapian.org/>
Xapian



More information about the Xapian-tickets mailing list