This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author shjohnson.pi
Recipients shjohnson.pi
Date 2013-07-18.22:11:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1374185482.63.0.0818947870098.issue18502@psf.upfronthosting.co.za>
In-reply-to
Content
CDLL does not use the same paths as find_library and thus you can *find* a library, but you can't necessarily use it.

In my case, I had SDL2 in /usr/local/lib. find_library correctly gets
the name, but does not return the path. CDLL apparently does not search
/usr/local/lib and fails.

Python 3.4.0a0 (default:5a6cdc0d7de1, Jul 18 2013, 17:55:27) 
[GCC 4.7.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import *
>>> import ctypes.util
>>> ctypes.util.find_library("SDL2")
'libSDL2-2.0.so.0'
>>> CDLL(_)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/steven/Programming/cpython/Lib/ctypes/__init__.py", line 351, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libSDL2-2.0.so.0: cannot open shared object file: No such file or directory
>>> CDLL("/usr/local/lib/libSDL2.so")
<CDLL '/usr/local/lib/libSDL2.so', handle 22f89c0 at 7fc966da5ae8>
History
Date User Action Args
2013-07-18 22:11:22shjohnson.pisetrecipients: + shjohnson.pi
2013-07-18 22:11:22shjohnson.pisetmessageid: <1374185482.63.0.0818947870098.issue18502@psf.upfronthosting.co.za>
2013-07-18 22:11:22shjohnson.pilinkissue18502 messages
2013-07-18 22:11:22shjohnson.picreate