Change in behavior (bug) in ctypes
Corinna Vinschen
corinna-cygwin@cygwin.com
Thu Jun 30 15:19:00 GMT 2016
On Jun 30 10:05, Marvin Greenberg wrote:
> Code like this was working until sometime recently,
>
> $ python
> >>> import ctypes
> >>> cygdll = ctypes.cdll.cygwin1
>
> But with the latest cygwin update, it is failing. On a couple older
> machines, I do:
>
>
> $ python -c "import ctypes; print ctypes._dlopen('cygwin1')"; cygcheck -V;
> python -V
> 6442713088
> cygcheck (cygwin) 2.1.0
> System Checker for Cygwin ...<snip>
> Python 2.7.10
>
> $ python -c "import ctypes; print ctypes._dlopen('cygwin1')"; cygcheck -V;
> python -V
> 6442713088
> cygcheck (cygwin) 2.5.1
> System Checker for Cygwin ...<snip>
> Python 2.7.10
>
> This last was on a windows 8.1 (Windows 8.1 Enterprise Ver 6.3 Build 9600)
> system. I updated cygwin completely on that system to cygwin latest from a
> mirror. And, then
>
> $ python -c "import ctypes; print ctypes._dlopen('cygwin1')"; cygcheck -V;
> python -V
> Traceback (most recent call last):
> File "<string>", line 1, in <module>
> OSError: No such file or directory
> cygcheck (cygwin) 2.5.2
> System Checker for Cygwin ...<snip>
> Python 2.7.10
>
> Note that simply changing the call to explicitly append the dll extension
> works fine:
>
> $ python -c "import ctypes; print ctypes._dlopen('cygwin1.dll')"
> 6442713088
>
> But that won't work with the former attribute-style of loading the dll.
Same as on Linux:
$ python -c "import ctypes; print ctypes._dlopen('libcurl')"
Traceback (most recent call last):
File "<string>", line 1, in <module>
OSError: libcurl: cannot open shared object file: No such file or directory
$ python -c "import ctypes; print ctypes._dlopen('libcurl.so')"
94888239442336
This was a fix for POSIX compat.
There's a bit of internal magic in Cygwin's dlopen() to handle .dll vs.
.so, but dlopen() does NOT add suffixes to the file on its own.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20160630/40970b3e/attachment.sig>
More information about the Cygwin
mailing list