I want to use python's (2.6.5) ctypes with cygwin, but I don't know how to load a dll.
I tried various variants like
>>> form ctypes import *
>>> cdll.LoadLibrary("/lib/libcairo.dll.a")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/ctypes/__init__.py", line 431, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python2.6/ctypes/__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
OSError: Permission denied
You won't be able to load an import library with the Python ctypes module; it has to be an actual DLL. I used both the cygwin crypt library and the crypt DLL import library as examples with a late model Cygwin on Win7.
Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01)
[GCC 4.3.4 20090804 (release) 1] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from ctypes import *
>>> cdll.LoadLibrary('cygcrypt-0.dll')
<CDLL 'cygcrypt-0.dll', handle 380000 at 7ef4564c>
>>>
>>>
>>> cdll.LoadLibrary('libcrypt.dll.a')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/ctypes/__init__.py", line 431, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python2.6/ctypes/__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
OSError: Permission denied
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With