
I have an application where it would be useful to set RTLD_GLOBAL on dlopen when import is used. Currently, python doesn't provide this option. Why not allow an optional argument to import that would allow this?

"Neal D. Becker" <ndbecker2@verizon.net> writes:
I have an application where it would be useful to set RTLD_GLOBAL on dlopen when import is used. Currently, python doesn't provide this option. Why not allow an optional argument to import that would allow this?
I take it you'd be interested to learn about sys.setdlopenflags? Cheers, mwh -- I'm about to search Google for contract assassins to go to Iomega and HP's programming groups and kill everyone there with some kind of electrically charged rusty barbed thing. -- http://bofhcam.org/journal/journal.html, 2002-01-08

Michael Hudson wrote:
"Neal D. Becker" <ndbecker2@verizon.net> writes:
I have an application where it would be useful to set RTLD_GLOBAL on dlopen when import is used. Currently, python doesn't provide this option. Why not allow an optional argument to import that would allow this?
I take it you'd be interested to learn about sys.setdlopenflags?
Could be. But I checked the current cvs python source, and what I see is dlopen is called with flags set to 0. What am I missing?

It works here: (python 2.3.3 on fedora core 2) $ ltrace -s 74 -e dlopen \ python -c 'import sys,dl; sys.setdlopenflags(dl.RTLD_LAZY); import _tkinter' dlopen("/usr/lib/python2.3/lib-dynload/dlmodule.so", 2) = 0x9ea7cf0 dlopen("/usr/lib/python2.3/lib-dynload/_tkinter.so", 1) = 0x9ea9c88 It's possible that some implementation of shared library loading don't obey sys.setdlopenflags(). In particular, it looks like dlopenflags will only be changed from 0 in dynload_shlib.c when PYCC_GCC is set. (line 111 in my recentish CVS version of that file) Jeff

Neal Becker <ndbecker2@verizon.net> writes:
Michael Hudson wrote:
"Neal D. Becker" <ndbecker2@verizon.net> writes:
I have an application where it would be useful to set RTLD_GLOBAL on dlopen when import is used. Currently, python doesn't provide this option. Why not allow an optional argument to import that would allow this?
I take it you'd be interested to learn about sys.setdlopenflags?
Could be. But I checked the current cvs python source, and what I see is dlopen is called with flags set to 0. What am I missing?
I don't know. That's not what I see in current CVS... the dlopen call I'm on about is line 130 of Python/dynload_shlib.c. (I notice that sys.setdlopenflags is present on Darwin, where it isn't going to make much difference...). Cheers, mwh -- 39. Re graphics: A picture is worth 10K words - but only those to describe the picture. Hardly any sets of 10K words can be adequately described with pictures. -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html
participants (4)
-
Jeff Epler
-
Michael Hudson
-
Neal Becker
-
Neal D. Becker