diff -Naur Python-3.5.2-orig/Lib/ctypes/__init__.py Python-3.5.2/Lib/ctypes/__init__.py --- Python-3.5.2-orig/Lib/ctypes/__init__.py 2016-06-26 00:38:35.000000000 +0300 +++ Python-3.5.2/Lib/ctypes/__init__.py 2016-07-12 14:22:43.305800700 +0300 @@ -427,7 +427,9 @@ cdll = LibraryLoader(CDLL) pydll = LibraryLoader(PyDLL) -if _os.name in ("nt", "ce"): +if _os.name == "nt" and _sys.version.find('GCC') >= 0: + pythonapi = PyDLL("libpython%d.%d%s.dll" % (_sys.version_info[:2] + (_sys.abiflags,)), None) +elif _os.name in ("nt", "ce"): pythonapi = PyDLL("python dll", None, _sys.dllhandle) elif _sys.platform == "cygwin": pythonapi = PyDLL("libpython%d.%d.dll" % _sys.version_info[:2])