Author martin.panter
Recipients Brian.Larsen, Daniel.Blanchard, Pau Tallada, amaury.forgeotdarc, belopolsky, jniehof, lukasz.langa, martin.panter, vinay.sajip, yaroslavvb
Date 2016-04-25.02:38:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1461551940.0.0.550850020793.issue9998@psf.upfronthosting.co.za>
In-reply-to
Content
I also found Issue 18502 essentially about the same incompatibility between CDLL() and find_library().

The problem I see with using find_library() to blindly load a library is that you could be loading an incompatible version (wrong soname). That is why I asked Pau why they couldn’t give the proper library name to CDLL().

I noticed that Python’s own “uuid” module calls CDLL(find_library("uuid")); see <https://hg.python.org/cpython/annotate/v3.5.1/Lib/uuid.py#l459>. On my Linux computer, the full library name is libuuid.so.1, and according to online man pages, this is also the case on Free BSD. So I wonder if the “uuid” module should call CDLL("libuuid.so.1") directly. If somebody invented a new incompatible version libuuid.so.2, Python’s uuid module might crash, or become subtly broken, but programs that linked directly to libuuid.so.1 would continue to work.

Does anyone have any valid use cases where they want to use a shared library on LD_LIBRARY_PATH or similar, but cannot use CDLL() or LoadLibrary() directly? If people really want a way to load a library given its compile-time name, maybe changing find_library() is a valid way forward. But to me the use case does not seem robust or worth blessing in Python’s standard library.
History
Date User Action Args
2016-04-25 02:39:00martin.pantersetrecipients: + martin.panter, vinay.sajip, amaury.forgeotdarc, belopolsky, lukasz.langa, jniehof, Brian.Larsen, yaroslavvb, Daniel.Blanchard, Pau Tallada
2016-04-25 02:38:59martin.pantersetmessageid: <1461551940.0.0.550850020793.issue9998@psf.upfronthosting.co.za>
2016-04-25 02:38:59martin.panterlinkissue9998 messages
2016-04-25 02:38:59martin.pantercreate