diff --git a/psycopg/_psycopg.vc9.amd64.manifest b/psycopg/_psycopg.vc9.amd64.manifest
new file mode 100644
index 00000000..e92d583f
--- /dev/null
+++ b/psycopg/_psycopg.vc9.amd64.manifest
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/psycopg/_psycopg.vc9.manifest b/psycopg/_psycopg.vc9.x86.manifest
similarity index 73%
rename from psycopg/_psycopg.vc9.manifest
rename to psycopg/_psycopg.vc9.x86.manifest
index ebfb890b..9fc55da4 100644
--- a/psycopg/_psycopg.vc9.manifest
+++ b/psycopg/_psycopg.vc9.x86.manifest
@@ -9,7 +9,7 @@
-
+
diff --git a/setup.py b/setup.py
index f5881e45..0640bc14 100644
--- a/setup.py
+++ b/setup.py
@@ -55,6 +55,7 @@ from distutils.command.build_ext import build_ext
from distutils.sysconfig import get_python_inc
from distutils.ccompiler import get_default_compiler
from distutils.dep_util import newer_group
+from distutils.util import get_platform
try:
from distutils.command.build_py import build_py_2to3 as build_py
except ImportError:
@@ -158,8 +159,13 @@ class psycopg_build_ext(build_ext):
sysVer = sys.version_info[:2]
if self.get_compiler().lower().startswith('msvc') and \
sysVer in ((2,6), (2,7)):
+ platform = get_platform()
+ # Default to the x86 manifest
+ manifest = '_psycopg.vc9.x86.manifest'
+ if platform == 'win-amd64':
+ manifest = '_psycopg.vc9.amd64.manifest'
self.compiler.spawn(['mt.exe', '-nologo', '-manifest',
- os.path.join('psycopg', '_psycopg.vc9.manifest'),
+ os.path.join('psycopg', manifest),
'-outputresource:%s;2' % (os.path.join(self.build_lib, 'psycopg2', '_psycopg.pyd'))])
def finalize_win32(self):