diff -Naur Python-3.5.2-orig/Modules/_ctypes/libffi/fficonfig.py.in Python-3.5.2/Modules/_ctypes/libffi/fficonfig.py.in --- Python-3.5.2-orig/Modules/_ctypes/libffi/fficonfig.py.in 2016-06-26 00:38:37.000000000 +0300 +++ Python-3.5.2/Modules/_ctypes/libffi/fficonfig.py.in 2016-07-12 14:21:52.330800700 +0300 @@ -23,6 +23,7 @@ 'FRV': ['src/frv/eabi.S', 'src/frv/ffi.c'], 'S390': ['src/s390/sysv.S', 'src/s390/ffi.c'], 'X86_64': ['src/x86/ffi64.c', 'src/x86/unix64.S', 'src/x86/ffi.c', 'src/x86/sysv.S'], + 'X86_WIN64': ['src/x86/ffi.c', 'src/x86/win64.S'], 'SH': ['src/sh/sysv.S', 'src/sh/ffi.c'], 'SH64': ['src/sh64/sysv.S', 'src/sh64/ffi.c'], 'PA': ['src/pa/linux.S', 'src/pa/ffi.c'], @@ -30,6 +31,9 @@ 'PA_HPUX': ['src/pa/hpux32.S', 'src/pa/ffi.c'], } +ffi_target = '@TARGET@' +if ffi_target not in ['X86_WIN32', 'X86_WIN64']: + ffi_sources += 'src/dlmalloc.c' ffi_sources += ffi_platforms['@TARGET@'] ffi_cflags = '@CFLAGS@' diff -Naur Python-3.5.2-orig/setup.py Python-3.5.2/setup.py --- Python-3.5.2-orig/setup.py 2016-07-12 14:21:41.084800700 +0300 +++ Python-3.5.2/setup.py 2016-07-12 14:21:52.349800700 +0300 @@ -1934,6 +1934,10 @@ return True def configure_ctypes(self, ext): + if host_platform == 'win32': + ext.libraries.extend(['ole32', 'oleaut32', 'uuid']) + ext.export_symbols.extend(['DllGetClassObject PRIVATE', + 'DllCanUnloadNow PRIVATE']) if not self.use_system_libffi: if host_platform == 'darwin': return self.configure_ctypes_darwin(ext) @@ -1958,6 +1962,10 @@ if not self.verbose: config_args.append("-q") + if host_platform == 'win32': + table = str.maketrans('\\', '/') + ffi_builddir = ffi_builddir.translate(table) + ffi_srcdir = ffi_srcdir.translate(table) # Pass empty CFLAGS because we'll just append the resulting # CFLAGS to Python's; -g or -O2 is to be avoided. cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \