bpo-4032: Cygwin: Add .dll.a to UnixCCompiler for searching libraries by ma8ma · Pull Request #4153 · python/cpython

Allow the UnixCCompiler.find_library_file to correctly find DLL import libs (.dll.a).

This is an alternative PR for #4136:

This simple patch allows UnixCCompiler.find_library_file, which searching library directories (e.g. /usr/lib), to recognize .dll.a as matches for the library. This is necessary on Cygwin where actual DLLs are not typically found under /lib, but rather /bin (because Windows searches PATH for DLLs). However one does .dll.a import libs under /lib (these are simple static archives that contain stubs for symbols actually found in the DLL, which can be used in lieu of the DLL itself for linking). This satisfies that the library being searched for is typically found.

This is especially necessary now that the _ctypes module can only be built with --with-system-ffi; without this patch the system libffi cannot be found.

The main difference to the original is the use of the implib_lib_extension variable. The original patch will overwrite the dylib_lib_extension variable which previously only had meaning on OSX, but is a bit of a misnomer for searching for DLL import libs on Cygwin.

https://bugs.python.org/issue4032