[Python-Dev] About dynamic module loading

dsign dignor.sign at gmail.com
Thu Jun 15 21:01:57 CEST 2006


   I saw in this list, or some of its relatives, an old discussion between
David Abrams, the developer of boost.python, and the devteam of python about
loading modules with RTLD_GLOBAL. Many useful comments and a lot of insight,
but didn't find a solution to the question posed by David. I don't like to
put a sys.dlopenflags  something around my imports of c++ modules, nor to
change 300 c++ files with template instantiations just to be able to export
some functionality to python. All I need is to use RTLD_GLOBAL in a user
transparent way for loading the extensions, so, if there already is a way of
doing so, please tell me (have into account that I read the complete
discussion thread of that time, if I miss the solution, let'me know).

If not, here's a modified version of the dynload_shlib.c file in:

http://dignor.sign.googlepages.com/dynloadpatchforpython2.4.1

that checks the existence of foo.so.global for module foo.so in the same dir
and if so, loads it using RTLD_GLOBAL. An ugly hack, I know, but it works
for me. Maybe there are other users with this problem and they can use this.

Best Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060615/53cca9f1/attachment.html 


More information about the Python-Dev mailing list