Windows MSVC: 64bit compiler sees 2 export symbols

The MSVC compiler sees a request for the main symbol (init__pyscopg) to be
exported twice during the build process and issues a warning in 64bit mode.
One symbol is from distutils exporting the library with the
build_ext.get_export_symbols() function, the other is from the #define
PyMODINIT_FUNC (define in pyport.h) that begins the main _psycopg module.
This patch overrides the get_export_symbols function and returns an empty
array of symbols to export if the compiler is MSVC.
This commit is contained in:
Jason Erickson 2011-02-24 14:12:40 -07:00 committed by Daniele Varrazzo
parent 7c2fa77c4b
commit 2997c0eb6c

View File

@ -155,6 +155,13 @@ class psycopg_build_ext(build_ext):
def get_pg_config(self, kind):
return get_pg_config(kind, self.pg_config)
def get_export_symbols(self, ext):
# Fix MSVC seeing two of the same export symbols.
if self.get_compiler().lower().startswith('msvc'):
return []
else:
return build_ext.get_export_symbols(self, ext)
def build_extension(self, ext):
build_ext.build_extension(self, ext)