diff -Naur Python-3.5.0-orig/Modules/_ctypes/libffi/fficonfig.py.in Python-3.5.0/Modules/_ctypes/libffi/fficonfig.py.in --- Python-3.5.0-orig/Modules/_ctypes/libffi/fficonfig.py.in 2015-09-13 14:41:24.000000000 +0300 +++ Python-3.5.0/Modules/_ctypes/libffi/fficonfig.py.in 2015-09-21 13:41:58.520304800 +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.0-orig/setup.py Python-3.5.0/setup.py --- Python-3.5.0-orig/setup.py 2015-09-21 13:41:50.381810900 +0300 +++ Python-3.5.0/setup.py 2015-09-21 13:41:58.521433600 +0300 @@ -1908,6 +1908,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) @@ -1932,6 +1936,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" \