Fixed LD_PRELOAD bug by forcing the global symbol table load.
authorBruno Abinader <bruno.abinader@openbossa.org>
Mon, 1 Jun 2009 23:28:37 +0000 (19:28 -0400)
committerBruno Abinader <bruno.abinader@openbossa.org>
Mon, 1 Jun 2009 23:33:32 +0000 (19:33 -0400)
By default, python isn't putting the purple.so or any dependency symbols
(oh hey, like libpurple.so!) in the global symbol table when loading it.
LD_PRELOAD works because the loader loads all libpurple's symbols before
python can. Thanks for darkrain42 for the help!

http://developer.pidgin.im/ticket/7872#comment:3

Signed-off-by: Bruno Abinader <bruno.abinader@openbossa.org>

nullclient-ecore.py
nullclient.py

index 571df91..76ff24c 100644 (file)
 
 import etk
 import ecore
 
 import etk
 import ecore
+import sys, dl
+
+sys.setdlopenflags(dl.RTLD_NOW | dl.RTLD_GLOBAL)
+
 import purple
 
 # The information below is needed by libpurple
 import purple
 
 # The information below is needed by libpurple
index 8c7cb6b..2dbbda0 100644 (file)
 #
 
 import getpass
 #
 
 import getpass
-import purple
-import sys
+import sys, dl
 import time
 
 import time
 
+sys.setdlopenflags(dl.RTLD_NOW | dl.RTLD_GLOBAL)
+
+import purple
+
 # The information below is needed by libpurple
 __NAME__ = "nullclient"
 __VERSION__ = "0.1"
 # The information below is needed by libpurple
 __NAME__ = "nullclient"
 __VERSION__ = "0.1"