STINNER Victor <vstin...@redhat.com> added the comment: Antoine: > Hmm, apparently the -l flag was added in #832799, for a rather complicated > case where the interpreter is linked with a library dlopened by an embedding > application (I suppose for some kind of plugin system). The OP there also > mentions RTLD_GLOBAL as a workaround (or perhaps the right way of achieving > the desired effect). > (also, the OP didn't mention why he used a shared library build, instead of > linking Python statically with the dlopened library)
bpo-34814 is linked to this use case: https://bugzilla.redhat.com/show_bug.cgi?id=1585201 is an example of Python embedded in C using dlopen("libpython2.7.so.1.0", RTLD_LOCAL | RTLD_NOW). Problem: some C extensions of the standard library cannot be loaded in this case, like _struct. On Fedora and RHEL, some C extensions like _struct are built by the "*shared*" section of Modules/Setup. In this case, these C extensions are not explicitly linked to libpython. IHMO it's a bad usage of dlopen(): libpython must always be loaded with RTLD_GLOBAL. bpo-832799 has been fixed by the following commit which modify distutils to link C extensions to libpython: commit 10acfd00b28a2aad7b73d35afdbc64b0baebea20 Author: Martin v. Löwis <mar...@v.loewis.de> Date: Mon Apr 10 12:39:36 2006 +0000 Patch #1429775: Link Python modules to libpython on linux if --enable-shared. Fixes #832799. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue21536> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com